#include <bits/stdc++.h>
using namespace std;
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  ;
  long long n, s;
  cin >> n >> s;
  long long arr[n + 1];
  for (long long i = 1; i <= n; i++) cin >> arr[i];
  long long dp[n + 1][s + 1];
  for (long long i = 0; i <= n; i++)
    for (long long j = 0; j <= s; j++) dp[i][j] = 0;
  for (long long i = 1; i <= n; i++) dp[i][arr[i]] = i;
  for (long long i = 1; i <= n; i++) {
    for (long long j = 1; j <= s; j++) {
      if (j >= arr[i]) dp[i][j] += dp[i - 1][j - arr[i]];
      if (i > 1) dp[i][j] += dp[i - 1][j];
    }
  }
  long long ans = 0;
  for (long long i = 1; i <= n; i++) ans = (0LL + ans + dp[i][s]);
  cout << ans << "\n";
  return 0;
}
