#include <bits/stdc++.h>
using namespace std;
const int N = 3005;
int v[N];
int dp[N];
int main() {
  int n, s;
  cin >> n >> s;
  for (int i = 1; i <= n; i++) {
    cin >> v[i];
  }
  long long ans = 0;
  for (int i = 1; i <= n; i++) {
    long long ansc = 0;
    dp[0] = i;
    ans += 1LL * dp[s - v[i]] * (n - i + 1);
    for (int ss = s; ss >= 0; ss--) {
      dp[min(ss + v[i], N)] += dp[ss];
    }
  }
  cout << ans;
  return 0;
}
