#include <bits/stdc++.h>
using namespace std;
long long sum[10001];
long long pd(int p, int q) {
  long long he = 0;
  for (int ii = p; ii <= q; ii++) {
    he = he + sum[ii];
  }
  return he;
}
int main() {
  ios::sync_with_stdio(false);
  int num, i, j, t;
  long long peo, k;
  while (cin >> num >> peo) {
    t = 0;
    for (i = 1; i <= num; i++) cin >> sum[i];
    for (i = 1; i <= num; i++) {
      for (j = i; j <= num; j++) {
        k = pd(i, j);
        if (k % peo == 0) t++;
      }
    }
    cout << t << endl;
  }
  return 0;
}
