#include <bits/stdc++.h>
using namespace std;
const int inf = 1 << 30;
const long long linf = 1LL << 62;
const int MAX = 510000;
long long dy[8] = {0, 1, 0, -1, 1, -1, 1, -1};
long long dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const double pi = acos(-1);
const double eps = 1e-7;
template <typename T1, typename T2>
inline bool chmin(T1 &a, T2 b) {
  if (a > b) {
    a = b;
    return true;
  } else
    return false;
}
template <typename T1, typename T2>
inline bool chmax(T1 &a, T2 b) {
  if (a < b) {
    a = b;
    return true;
  } else
    return false;
}
template <typename T1, typename T2>
inline void print2(T1 a, T2 b) {
  cout << a << " " << b << endl;
}
template <typename T1, typename T2, typename T3>
inline void print3(T1 a, T2 b, T3 c) {
  cout << a << " " << b << " " << c << endl;
}
const int mod = 998244353;
int main() {
  long long n, s;
  cin >> n >> s;
  vector<long long> a(n);
  for (long long i = 0; i < (n); i++) cin >> a[i];
  vector<vector<long long> > dp(n + 1, vector<long long>(s + 1, 0));
  dp[0][0] = 1;
  for (long long i = 0; i < (n); i++) {
    for (long long j = s; j >= 0; j--) {
      dp[i + 1][j] += dp[i][j];
      if (j + a[i] > s) continue;
      if (j != 0)
        dp[i + 1][j + a[i]] += dp[i][j];
      else
        dp[i + 1][j + a[i]] += dp[i][j] + i;
    }
  }
  long long ans = 0;
  for (long long i = 0; i < (n + 1); i++) {
    ans += dp[i][s];
  }
  cout << ans << endl;
}
