#include <bits/stdc++.h>
using namespace std;
long long n, s, a, dp[3001][3001], ans;
signed main() {
  cin >> n >> s;
  dp[0][0] = 1;
  for (long long i = 1; i <= (long long)(n); ++i) {
    cin >> a;
    for (long long j = 0; j < (long long)(s + 1); ++j) {
      long long d = 0;
      if (j >= a) d = dp[i - 1][j - a];
      dp[i][j] = dp[i - 1][j] + d;
    }
    dp[i][0]++;
    if (a <= s) {
    }
    ans += dp[i][s];
  }
  cout << ans << endl;
}
