#include <bits/stdc++.h>
using namespace std;
int n, m;
long long sum[100010];
void read(int &para) {
  char ch = getchar();
  while (ch < '0' || ch > '9') ch = getchar();
  int x = 0;
  while (ch >= '0' && ch <= '9')
    x = (x << 3) + (x << 1) + (ch ^ 48), ch = getchar();
  para = x;
}
int main(int argc, char **argv) {
  read(n);
  read(m);
  int ans = 0;
  for (int i = 1; i <= n; i++) cin >> sum[i], sum[i] += sum[i - 1];
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= i && sum[i] - sum[j - 1] >= m; j++) {
      if ((sum[i] - sum[j - 1]) % m == 0) ans++;
    }
  }
  cout << ans << endl;
  return 0;
}
