Takahashi is playing with N cards.

The i-th card has an integer X_i on it.

Takahashi is trying to create as many pairs of cards as possible satisfying one of the following conditions:

* The integers on the two cards are the same.
* The sum of the integers on the two cards is a multiple of M.



Find the maximum number of pairs that can be created.

Note that a card cannot be used in more than one pair.

Constraints

* 2≦N≦10^5
* 1≦M≦10^5
* 1≦X_i≦10^5

Input

The input is given from Standard Input in the following format:


N M
X_1 X_2 ... X_N


Output

Print the maximum number of pairs that can be created.

Examples

Input

7 5
3 1 4 1 5 9 2


Output

3


Input

15 10
1 5 6 10 11 11 11 20 21 25 25 26 99 99 99


Output

6
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.HashSet;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskD solver = new TaskD();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskD {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int n = in.nextInt(), m = in.nextInt();
            int[] arr = new int[n];
            int cmatch = 0;

            HashSet<Integer> hs = new HashSet<>();

            int[] matched = new int[m];
            int[] excess = new int[m];
            for (int i = 0; i < n; i++) {
                arr[i] = in.nextInt();
                int b = arr[i] % m;
                if (hs.contains(arr[i])) {
                    hs.remove(arr[i]);
                    cmatch++;
                    matched[b] += 2;
                    excess[b]--;
                } else {
                    hs.add(arr[i]);
                    excess[b]++;
                }
            }
            cmatch += excess[0] / 2;

            for (int i = 1; i < m - i; i++) {
                int wmatch = Math.min(excess[i], excess[m - i]);
                cmatch += wmatch;
                excess[i] -= wmatch;
                excess[m - i] -= wmatch;
                while (true) {
                    boolean changed = false;
                    if (excess[i] > 0 && matched[m - i] > 0) {
                        matched[m - i] -= 2;
                        excess[m - i]++;
                        excess[i]--;
                        changed = true;
                    }
                    wmatch = Math.min(excess[i], excess[m - i]);
                    cmatch += wmatch;
                    excess[i] -= wmatch;
                    excess[m - i] -= wmatch;
                    if (excess[m - i] > 0 && matched[i] > 0) {
                        matched[i] -= 2;
                        excess[i]++;
                        excess[m - i]--;
                        changed = true;
                    }
                    wmatch = Math.min(excess[i], excess[m - i]);
                    cmatch += wmatch;
                    excess[i] -= wmatch;
                    excess[m - i] -= wmatch;

                    if (!changed) break;
                }
            }

            if (m % 2 == 0) {
                cmatch += excess[m / 2] / 2;
            }

            out.println(cmatch);
        }

    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

    }
}

