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