#include <bits/stdc++.h>
using namespace std;
vector<long long> sum(int n, vector<int> a) {
  vector<long long> s(n);
  for (int i = 0; i < n; i++) {
    if (i == 0) {
      s[i] = a[i];
      continue;
    }
    s[i] = s[i - 1] + a[i];
  }
  return s;
}
int main() {
  int n, m;
  long long count = 0;
  cin >> n >> m;
  vector<int> a(n);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  vector<long long> s = sum(n, a);
  for (int i = 0; i < n; i++) {
    for (int j = i; j < n; j++) {
      long long tong = s[j] - (i == 0 ? 0 : s[i - 1]);
      long long k = tong / m;
      if (k * m == tong) {
        count += 1;
      }
    }
  }
  cout << count;
}
