#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7, A = 1e5 + 5;
int main() {
  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  int n, m;
  cin >> n >> m;
  long long a[n], acc[n];
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    acc[i] = a[i] + (i ? acc[i - 1] : 0);
  }
  long long ans = 0;
  for (int i = 0; i < n; i++) {
    bool done;
    long long x = m, eq;
    int ind = i, low, high, mid;
    while (x <= acc[n - 1] - (i ? acc[i - 1] : 0)) {
      low = ind, high = n - 1, done = 0;
      while (low <= high) {
        mid = (low + high) / 2;
        eq = acc[mid] - (i ? acc[i - 1] : 0);
        if (eq == x) {
          ind = mid, done = 1;
          break;
        } else
          eq < x ? low = mid + 1 : high = mid - 1;
      }
      ans += done, x += m;
    }
  }
  cout << ans;
  return 0;
}
