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
#include <bits/stdc++.h>
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

int n, m;
vector<long long> xcnt(100100, 0);
vector< vector<long long> > xmodcnt(100100, vector<long long>());
vector<long long> xmodsum(100100, 0);

long long lrmodsum(int l, int r) {
    long long lrcnt = 0;
    long long lsum = xmodsum.at(l); long long rsum = xmodsum.at(r);
    if(lsum < rsum) {
        // 余りの小さい方が要素数が少ないとき
        for(int i = 0; i < xmodcnt.at(r).size(); ++i) {
            long long xmcnt = xmodcnt.at(r).at(i);
            while(xmcnt > 1) {
                if(rsum-2 < lsum) break;
                else {
                    xmcnt -= 2;
                    rsum -= 2;
                    lrcnt++;
                }
            }
        }
        lrcnt += lsum;
    }else {
        // 余りの小さい方が要素数が多いとき
        for(int i = 0; i < xmodcnt.at(l).size(); ++i) {
            long long xmcnt = xmodcnt.at(l).at(i);
            while(xmcnt > 1) {
                if(lsum-2 < rsum) break;
                else {
                    xmcnt -= 2;
                    lsum -= 2;
                    lrcnt++;
                }
            }
        }
        lrcnt += rsum;
    }
    return lrcnt;
}

int main() {
    cin >> n >> m;
    vector<long long> x(n, 0);
    for(int i = 0; i < n; ++i) {
        cin >> x.at(i);
        xcnt.at(x.at(i))++;
    }
    sort(x.begin(), x.end());
    x.erase(unique(x.begin(), x.end()), x.end());
    int xlen = x.size();
    for(int i = 0; i < xlen; ++i) {
        int mx = x.at(i) % m;
        xmodcnt.at(mx).push_back(xcnt.at(x.at(i)));
    }

    for(int i = 0; i < m; ++i) {
        for(int j = 0; j < xmodcnt.at(i).size(); ++j) {
            xmodsum.at(i) += xmodcnt.at(i).at(j);
        }
    }

    long long cnt = 0;
    if(m % 2 == 0) {
        for(int i = 0; i < m/2; ++i) {
            if(i == 0) {
                cnt += xmodsum.at(0)/2;
                cnt += xmodsum.at(m/2)/2;
            }else {
                int lch = i; int rch = m-i;
                cnt += lrmodsum(lch, rch);
            }
        }
    }else {
        for(int i = 0; i <= m/2; ++i) {
            if(i == 0) {
                cnt += xmodsum.at(i)/2;
            }else {
                int lch = i; int rch = m-i;
                cnt += lrmodsum(lch, rch); 
            }
        }
    }

    cout << cnt << endl;
}