import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.HashMap; import java.util.HashSet; import java.util.Map; import java.util.Set; public class Main { public static void main(String[] args) throws Exception { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String[] sa = br.readLine().split(" "); int n = Integer.parseInt(sa[0]); long m = Long.parseLong(sa[1]); sa = br.readLine().split(" "); long[] a = new long[n]; for (int i = 0; i < n; i++) { a[i] = Long.parseLong(sa[i]); } br.close(); Map map = new HashMap<>(); for (int i = 0; i < n; i++) { long k = a[i] % m; map.put(k, map.getOrDefault(k, 0) + 1); } long m2 = m % 2 == 0 ? m / 2 : 0; int ans = 0; Set set = new HashSet<>(); for (long key : map.keySet()) { int v1 = map.get(key); if (key == 0 || key == m2) { ans++; } else if (!set.contains(key)) { set.add(m - key); int v2 = map.getOrDefault(m - key, 0); ans += Math.max(v1, v2); } set.add(key); } System.out.println(ans); } }