#include <bits/stdc++.h>
using namespace std;
const double PI = acos(-1);
const double EPS = 1e-9;
long long gcd(long long a, long long b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
long long lcm(long long a, long long b) { return a / gcd(a, b) * b; }
long long dp[3005][3005] = {};
signed main(void) {
  long long n, s;
  cin >> n >> s;
  vector<long long> a(n);
  for (long long i = 0; i < (n); i++) cin >> a[i];
  for (long long i = 0; i < (n); i++) {
    dp[i][0] = i + 1;
    dp[i + 1][a[i]] += dp[i][0];
    for (long long j = 1; j < (s + 1); j++) {
      dp[i + 1][j] += dp[i][j];
      if (j + a[i] <= s) dp[i + 1][j + a[i]] += dp[i][j];
    }
  }
  long long ans = 0;
  for (long long i = 0; i < (n + 1); i++) ans += dp[i][s];
  cout << ans << endl;
}
