#include <bits/stdc++.h>
using namespace std;
inline long long chkmax(long long &x, long long y) {
  if (y > x) {
    x = y;
    return true;
  }
  return false;
}
inline long long chkmin(long long &x, long long y) {
  if (y < x) {
    x = y;
    return true;
  }
  return false;
}
const long long maxn = 3010;
long long dp[maxn][maxn];
signed main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);
  long long n, second;
  cin >> n >> second;
  vector<long long> a(n);
  for (long long i = 0; i < n; i++) {
    cin >> a[i];
  }
  long long res = 0;
  vector<vector<long long>> dp(n + 1, vector<long long>(second + 1));
  for (long long i = 1; i <= n; i++) {
    if (a[i - 1] <= second) {
      dp[i][a[i - 1]] += i;
    }
    for (long long j = 0; j <= second; j++) {
      dp[i][j] += dp[i - 1][j];
    }
    for (long long j = 0; j <= (second - a[i - 1]); j++) {
      dp[i][j + a[i - 1]] += dp[i - 1][j];
    }
    res += dp[i][second];
  }
  cout << res;
  return 0;
}
