pseudocode notation / find a pair such that when you subtract one from the other it should equal to zero in mod n

Initialize all items of the array X by -1

For at most m steps:

  1. Pick a number from the set A and keep it in the variable a
  2. Remove a from the set A
  3. Calculate r = a mod n (remainder of a / n)
  4. If X[r] = -1 (there is no a such that r = a mod n before), then set X[r] = a, Else, (there was a such that r = a mod n before) so return the pair (X[r], a) which both have the same remainder respect with n.