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 <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cmath>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <sstream>
#include <string>
#define _repargs(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rep(...) _repargs(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()
#define mod 1000000007
#define inf 2000000007
#define mp make_pair
#define pb push_back
typedef long long ll;
using namespace std;
template <typename T>
inline void output(T a, int p = 0) {
    if(p) cout << fixed << setprecision(p)  << a << "\n";
    else cout << a << "\n";
}
// end of template

int main() {
    cin.tie(0);
    ios::sync_with_stdio(0);
    // source code
    
    int N, M;
    cin >> N >> M;
    vector<int> cnt(100001);
    vector<int> A(M); // あまりがiの個数
    rep(i, N) {
        int a;
        cin >> a;
        cnt[a]++;
        A[a % M]++;
    }
    int ans = 0;
    ans += A[0] / 2;
    if(M % 2 == 0) ans += A[M / 2] / 2;
    
    vector<int> R(M); // 奇数個の個数
    vector<int> D(M);
    rep(i, cnt.size()){
        if(cnt[i] % 2 == 1) R[i % M]++;
    }
    rep(i, 1, M){
        if(i == M - i) continue;
        if(R[i] && R[M - i]){
            int m = min(R[i], R[M - i]);
            ans += m;
            R[i] -= m;
            R[M - i] -= m;
            D[i] += m;
            D[M - i] += m;
            A[i] -= m;
            A[M - i] -= m;
        }
    }
    rep(i, cnt.size()){
        if(cnt[i] % 2 == 1 && D[i % M] > 0){
            cnt[i]--, D[i % M]--;
        }
    }
    vector<int> P(M);
    
    rep(i, cnt.size()){
        
        P[i % M] += cnt[i] / 2;
    }
    
    rep(i, 1, M){
        if(i == M - i) continue;
        int m = min(A[i], A[M - i]);
        A[i] -= m;
        A[M - i] -= m;
        ans += m;
    }
    
    rep(i, 1, M){
        if(i != M - i) ans += min(P[i], A[i] / 2);
    }
    
    
    
//    rep(i, cnt.size()){
//        ans += cnt[i] / 2;
//    }
//    
//    rep(i, 1, M){
//        if(R[i] > 0 && A[M - i] > 0){
//            int m = min(R[i], A[M - i]);
//            A[M - i] -= m;
//            ans += m / 2;
//        }
//    }
    
    
    output(ans);
    
    
    
    return 0;
}