N, M = list(map(int, input().split()))
A = list(map(int, input().split()))

mod = [a%M for a in A]

mod_dict={}
mod_dict[0]=1

for m in mod:
  mod_dict[m]=mod_dict.get(m,0)+1

answer=0

for x in mod_dict.values():
  answer+=x-1

print(int(answer))
