#include <bits/stdc++.h>
using namespace std;
int main() {
  long long N, M;
  cin >> N >> M;
  vector<long long> B;
  B.push_back(0);
  for (long long i = 0; i < N; i++) {
    long long x;
    cin >> x;
    B.push_back((x + B[i]) % M);
  }
  long long ans = 0;
  for (long long i = 0; i <= N; i++) {
    for (long long j = i + 1; j <= N; j++) {
      if (((B[j] - B[i]) % M) == 0) ans++;
    }
  }
  cout << ans << endl;
  return 0;
}
