#include <bits/stdc++.h>
#pragma GCC optimize("O3")
using namespace std;
int main() {
  ios::sync_with_stdio(0);
  int n, m;
  cin >> n >> m;
  long long a[n + 1];
  memset(a, 0, sizeof(a));
  for (int i = 1; i <= n; ++i) {
    int x;
    cin >> x;
    a[i] = a[i - 1] + x;
  }
  int ans = 0;
  for (int i = 1; i <= n; ++i)
    for (int j = 1; a[i - 1] + j * m <= a[n]; ++j) {
      long long next = a[i - 1] + j * m;
      long long x = *lower_bound(a + i, a + n + 1, next);
      if (next == x) ans++;
    }
  cout << ans << endl;
  return 0;
}
