#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long int n, k;
  cin >> n >> k;
  long long int a[105];
  long long int dp[n + 5][k + 5];
  for (int i = 1; i <= n; i++) cin >> a[i];
  memset(dp, 0, sizeof(dp));
  for (int i = 1; i <= n; i++) dp[i][0] = 1;
  for (int j = 1; j <= n; j++) {
    if (j <= a[1])
      dp[1][j] = 1;
    else
      dp[1][j] = 0;
  }
  for (int i = 2; i <= n; i++) {
    for (int j = 1; j <= k; j++) {
      if (j <= a[i])
        dp[i][j] = dp[i][j - 1] + dp[i - 1][j];
      else {
        dp[i][j] = dp[i][j - 1] + dp[i - 1][j] - dp[i - 1][j - a[i] - 1];
      }
    }
  }
  cout << dp[n][k] << endl;
}
