#include <bits/stdc++.h>
using namespace std;
int Pair(int *Se, int L, int R, int S);
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int N, S, tmp, count = 0;
  vector<int> A;
  cin >> N >> S;
  int Se[N];
  for (int i = 0; i < N; i++) {
    cin >> tmp;
    A.push_back(tmp);
  }
  Se[0] = A[0];
  for (int i = 1; i <= N; i++) {
    if (Se[i - 1] == S) count++;
    Se[i] = Se[i - 1] + A[i];
  }
  for (int L = 1; L < N; L++) {
    for (int R = L; R <= N; R++) {
      count += Pair(Se, L, R, S);
    }
  }
  cout << count << endl;
  return 0;
}
int Pair(int *Se, int L, int R, int S) {
  int count = 0;
  for (int i = L; i < R; i++) {
    for (int j = i; j <= R; j++) {
      if (Se[j] - Se[i - 1] == S) count++;
    }
  }
  return count;
}
