#include <bits/stdc++.h>
using namespace std;
int dx[] = {1, -1, 0, 0};
int dy[] = {0, 0, 1, -1};
const int INF = 100000000;
const long long LINF = 10000000000000000ll;
const int MOD = 1e9 + 7;
const double EPS = 1e-9;
int N;
long long M;
long long a[100010];
long long s[100010];
void init() {}
void solve() {
  long long ans = 0;
  s[0] = a[0];
  for (int i = (1); i < (N); i++) s[i] = s[i - 1] + a[i];
  long long sub = 0;
  for (int i = 0; i < (N); i++) {
    int n = 1;
    while (n * M + sub <= s[N - 1]) {
      ans += upper_bound(s + i, s + N, n * M + sub) -
             lower_bound(s + i, s + N, n * M + sub);
      n++;
    }
    sub += a[i];
  }
  cout << ans << endl;
}
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cin >> N >> M;
  for (int i = 0; i < (N); i++) {
    cin >> a[i];
  }
  solve();
  return 0;
}
