Check for each body individually if it collides with the other one or ignores it. When a body is being ignored, the other body's mass is considered infinite when applying impulses to avoid extra overlapping.