N,M = [int(x) for x in input().split()]
Alist = [int(x) for x in input().split()]

def curlist(l):
  culist = []
  for i in range(len(l)):
    for j in range(len(l)):
      d = l[i] + l[j]
      if i == j:
        d = d / 2
      culist.append(d)
  return culist

Blist = curlist(Alist)
a = [x for x in Blist if (x % M) == 0 and x > M]
print(len(a))