'use strict';

const fs = require('fs');

process.stdin.resume();
process.stdin.setEncoding('utf-8');

let inputString = '';
let currentLine = 0;

process.stdin.on('data', function(inputStdin) {
    inputString += inputStdin;
});

process.stdin.on('end', function() {
    inputString = inputString.split('\n');

    main();
});

process.on('SIGINT', function() {
    inputString = inputString.split('\n');

    main();
    process.exit(0);
});

function readLine() {
    return inputString[currentLine++];
}

/*
 * Complete the 'nonDivisibleSubset' function below.
 *
 * The function is expected to return an INTEGER.
 * The function accepts following parameters:
 *  1. INTEGER k
 *  2. INTEGER_ARRAY s
 */

function nonDivisibleSubset(k, s) {
    let counts = new Array(k);
    for (let i = 0; i < k; i++) {
        counts[i] = 0;
    }

    for (let el of s) {
        counts[el % k]++;
    }

    let count = Math.min(1, counts[0]);
    for (let i = 1; i <= k >> 1; i++) {
        let j = k - i;
        if (i !== j) {
            count += Math.max(counts[i], counts[j]);
        } else {
            count += Math.min(1, counts[i]);
        }
    }
    return count;
}

function main() {
    const ws = fs.createWriteStream(process.env.OUTPUT_PATH);

    const firstMultipleInput = readLine().replace(/\s+$/g, '').split(' ');

    const n = parseInt(firstMultipleInput[0], 10);

    const k = parseInt(firstMultipleInput[1], 10);

    const s = readLine().replace(/\s+$/g, '').split(' ').map(sTemp => parseInt(sTemp, 10));

    const result = nonDivisibleSubset(k, s);

    console.log(`Result ${result}`);

    ws.write(result + '\n');

    ws.end();
}
