n,m=map(int,input().split()) aa=map(int,input().split()) s=set() for a in aa: s.add(min(a%m,-a%m)) print(len(s))