#include <bits/stdc++.h>
using namespace std;
long long mypow(long long a, long long b, long long c) {
  if (b == 0) return 1;
  if (b % 2) return mypow(a, b - 1, c) * a % c;
  long long z = mypow(a, b / 2, c);
  return z * z % c;
}
long long dp[3010][3010];
long long c[3010];
signed main() {
  long long a, b;
  cin >> a >> b;
  for (long long i = 0; i < a; i++) cin >> c[i];
  dp[0][0] = 1;
  for (long long i = 0; i < a; i++) {
    for (long long j = 0; j < b + 1; j++) {
      if (j == 0)
        dp[i + 1][0] = dp[i][0] + 1;
      else if (j >= c[i]) {
        dp[i + 1][j] = dp[i][j] + dp[i][j - c[i]];
      } else
        dp[i + 1][j] = dp[i][j];
    }
  }
  long long ans = 0;
  for (long long i = 0; i < a; i++) {
    ans += dp[i + 1][b];
  }
  cout << ans << endl;
}
