#include <bits/stdc++.h>
using namespace std;
long long ncrp(long long n, long long r, long long p) {
  long long C[r + 1];
  memset(C, 0, sizeof(C));
  C[0] = 1;
  for (long long i = 1; i <= n; i++)
    for (long long j = min(i, r); j >= 1; j--) C[j] = (C[j] + C[j - 1]) % p;
  return C[r];
}
long long mod_exp(long long x, long long y, long long mm) {
  if (y == 0)
    return (1);
  else if (y % 2 == 0)
    return (mod_exp((x * x) % mm, y / 2, mm));
  else
    return ((x * mod_exp((x * x) % mm, (y - 1) / 2, mm)) % mm);
}
int main() {
  long long n, k;
  cin >> n >> k;
  long long arr[n + 1];
  long long sum[n + 1];
  long long dp[n + 1][k + 1];
  sum[0] = 0;
  for (long long i = 1; i <= n; i++) cin >> arr[i];
  for (long long i = 1; i <= n; i++) {
    sum[i] = sum[i - 1] + arr[i];
  }
  for (long long i = 0; i <= n; i++) {
    dp[i][0] = 1;
  }
  for (long long i = 1; i <= k; i++) dp[0][i] = 0;
  for (long long i = 1; i <= n; i++) {
    for (long long j = 1; j <= k; j++) {
      dp[i][j] = 0;
      if (sum[i] >= j) {
        for (long long a1 = 0; a1 <= min(arr[i], j); a1++) {
          dp[i][j] = dp[i][j] + dp[i - 1][j - a1];
        }
      } else
        dp[i][j] = 0;
    }
  }
  cout << dp[n][k];
}
