from collections import defaultdict n,m = map(int,input().split()) a = list(map(int,input().split())) b = [num%m for num in a] d = defaultdict(int) ans = 0 for num in b: if num == 0: ans |= 1 else: d[num] += 1 d[m] = 0 for num in b: ans += max(d[num],d[m-num]) d[num] = 0 d[m-num] = 0 print(ans)