#include <bits/stdc++.h>
using namespace std;
long long a[110000];
int main() {
  unordered_map<long long, int> ma;
  long long n, m;
  scanf("%lld%lld", &n, &m);
  long long sum = 0, tot = 0;
  for (long long i = 1; i <= n; ++i) {
    scanf("%lld", &a[i]);
    if (a[i] % m) ++sum;
    a[i] = a[i] % m;
  }
  for (int i = 1; i <= n; ++i) {
    if (ma[a[i]]) sum += ma[a[i]];
    ma[a[i]]++;
  }
  printf("%lld\n", sum);
  return 0;
}
