#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
const int mod = 1000000007;
const int inf = (1 << 30) - 1;
const ll linf = (1LL << 62LL) - 1;
const double EPS = (1e-10);
P ar4[4] = {{0, 1}, {0, -1}, {1, 0}, {-1, 0}};
P ar8[8] = {{-1, -1}, {-1, 0}, {-1, 1}, {0, -1},
            {0, 1},   {1, -1}, {1, 0},  {1, 1}};
int n, s;
vector<int> A;
int DFS(int nw, int p) {
  if (p == s) {
    return (n - nw + 1);
  }
  if (nw == n) {
    return 0;
  }
  if (p > s) {
    return 0;
  }
  if (A[nw] + p == s) {
    return (n - nw);
  }
  int ans = 0;
  if (A[nw] + p < s) ans += DFS(nw + 1, p + A[nw]);
  ans += DFS(nw + 1, p);
  return ans;
}
__attribute__((constructor)) void initial() {
  cin.tie(0);
  ios::sync_with_stdio(false);
}
int main() {
  cin >> n >> s;
  for (int i = 0; n > i; i++) {
    int t;
    cin >> t;
    A.push_back(t);
  }
  int ans = 0;
  for (int i = 0; n > i; i++) {
    ans += (i + 1) * DFS(i + 1, A[i]);
  }
  cout << ans << endl;
}
