#include <bits/stdc++.h>
using namespace std;
long long N;
long long M;
long long A[100001];
long long add[100001];
long long amari[100001];
long long ans = 0;
signed main(void) {
  cin >> N >> M;
  A[0] = 0;
  add[0] = 0;
  amari[0] = 0;
  for (long long i = 1; i < N + 1; i++) {
    cin >> A[i];
    add[i] = add[i - 1] + A[i];
    amari[i] = add[i] % M;
  }
  for (long long i = 1; i < N + 1; i++) {
    for (long long j = 0; j < i; j++) {
      if (amari[i] == amari[j]) {
        ans++;
      }
    }
  }
  cout << ans << endl;
  return 0;
}
