using System; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Numerics; using System.Text; //using static CompLib.CompLib; //using DataStructure; namespace atcoder { class Program { const int intMax = 1000000000; const long longMax = 2000000000000000000; static void Main(string[] args) { var NM = Console.ReadLine().Trim().Split().Select(long.Parse).ToArray(); var A = Console.ReadLine().Trim().Split().Select(long.Parse).ToArray(); for (int i = 0; i < NM[0]; i++) { A[i] %= NM[1]; } var list = new Dictionary(); for (int i = 0; i < NM[0]; i++) { if (!list.ContainsKey(A[i])) { list.Add(A[i], 1); } else { list[A[i]]++; } } long ans = NM[0]; for (int i = 0; i < list.Count; i++) { if (list.ElementAt(i).Key == 0 || (NM[1] % 2 == 0 && list.ElementAt(i).Key == NM[1] / 2)) { ans -= list.ElementAt(i).Value - 1; list[list.ElementAt(i).Key] = 0; } else if (list.ContainsKey(NM[1] - list.ElementAt(i).Key)) { ans -= Math.Min(list[NM[1] - list.ElementAt(i).Key], list.ElementAt(i).Value); list[NM[1] - list.ElementAt(i).Key] = 0; list[list.ElementAt(i).Key] = 0; } } Console.WriteLine(ans); } } }