n,m = map(int,input().split()) a = list(map(int,input().split())) from collections import defaultdict m_d = defaultdict(int) for i in range(n): m_d[a[i]%m] += 1 max_ = 0 for key in m_d.keys(): if key == 0:continue if not (m&1) and key == m//2:continue max_ += m_d[key] ans = 0 if m_d[0]:ans += 1 if not (m&1) and m_d[m//2]:ans+1 memo = set() for key in list(m_d.keys())[::]: if key == 0:continue if not (m&1) and key == m//2:continue if key in memo:continue ans += max(m_d[key], m_d[m-key]) memo.add(m-key) print(ans)