#include <bits/stdc++.h>
using namespace std;
long long dp[101][100001];
int main() {
  long long n, k;
  cin >> n >> k;
  long long children[n];
  for (int i = 0; i < n; i++) {
    cin >> children[i];
  }
  dp[0][0] = 1;
  for (int i = 0; i < n; i++) {
    long long prefix[k + 2];
    prefix[0] = 0;
    for (int j = 1; j <= k + 1; j++) {
      prefix[j] = prefix[j - 1] + dp[i][j - 1];
    }
    for (long long j = 0; j <= k; j++) {
      dp[i + 1][j] =
          prefix[j + 1] - prefix[max((long long)(0), j - children[i])];
    }
  }
  cout << dp[n][k] << endl;
}
