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