#include <bits/stdc++.h>
using namespace std;
const long long N = 110, K = 1e5 + 1e2;
long long n, dp[N][K], ps[N][K], k, a[N];
int32_t main() {
  ios_base::sync_with_stdio(true == false);
  cin >> n >> k;
  for (long long i = 1; i <= n; i++) {
    cin >> a[i];
  }
  for (long long i = 0; i <= k; i++) {
    dp[1][i] = (a[1] >= i);
    ps[1][i] = ps[1][max(0ll, i - 1)] + dp[1][i];
  }
  for (long long i = 2; i <= n; i++) {
    for (long long j = 0; j <= k; j++) {
      if (j <= a[i]) {
        dp[i][j] = ps[i - 1][j];
      } else {
        dp[i][j] = ps[i - 1][j] - ps[i - 1][j - a[i] - 1];
      }
      ps[i][j] = ps[i][j - 1] + dp[i][j];
    }
  }
  cout << dp[n][k];
}
