#include <bits/stdc++.h>
using namespace std;
int main() {
  int N, M;
  cin >> N >> M;
  map<long long, long long> counter;
  for (int i = 0; i < N; ++i) {
    long long a;
    cin >> a;
    counter[a % M]++;
  }
  int L = counter.size();
  long long ans = 0;
  for (auto p : counter) {
    long long c = p.second;
    ans += (c * (c - 1)) / 2;
  }
  ans += counter[0];
  cout << ans << endl;
  return 0;
}
