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