#include <bits/stdc++.h>
using namespace std;
int main() {
  long long N, M;
  cin >> N >> M;
  vector<long long> a(N);
  vector<long long> d(N + 1, 0);
  for (int i = 0; i < N; i++) {
    cin >> a[i];
    d[i + 1] += d[i] + a[i];
  }
  long long res = 0;
  for (int l = 0; l < N; l++) {
    for (int r = l + 1; r <= N; r++) {
      long long sum = d[r] - d[l];
      if (sum % M == 0) ++res;
    }
  }
  cout << res << endl;
  return 0;
}
