from collections import Counter def main(): N, M = map(int, input().split()) set_ = list(map(int, input().split())) modulo_list = map(lambda num: num % M, set_) modulo_counter = Counter(modulo_list) if modulo_counter[0] > 0: modulo_counter[0] = 1 if M % 2 == 0 and modulo_counter[M // 2] > 0: modulo_counter[M // 2] = 1 for num in range(1, (M+1)//2): if modulo_counter[num] > modulo_counter[M-num]: modulo_counter[M-num] = 0 else: modulo_counter[num] = 0 print(sum(modulo_counter.values())) if __name__ == "__main__": main()