The light from a foreground object told astronomers how much mass appeared to be there. The gravitational-lensing effect on the background object told them how much foreground mass was there. The difference between the two amounts was the dark matter.