#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1000000007ll;
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long n, k;
  cin >> n >> k;
  vector<long long> dp(k + 1, 0);
  vector<long long> pre(k + 1, 0);
  dp[0] = 1;
  for (long long i = 1; i <= n; i++) {
    pre[0] = dp[0];
    for (long long j = 1; j <= k; j++) pre[j] = pre[j - 1] + dp[j];
    long long a;
    cin >> a;
    for (long long j = k; j >= 1; j--) {
      long long r = j - 1, l = max(0LL, j - a);
      long long ans = pre[r];
      if (l > 0) ans -= pre[l - 1];
      dp[j] += ans;
    }
  }
  cout << dp[k];
  return 0;
}
