#include <bits/stdc++.h>
using namespace std;
static const double PI = 3.141592653589793;
long long int mod = 1000000007;
long long int a[105], dp[105][100005], sum[105][100005];
int main() {
  long long int n, k;
  cin >> n >> k;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
  }
  dp[0][0] = 1;
  for (int i = 0; i <= k; i++) {
    sum[0][i] = 1;
  }
  for (int i = 1; i <= n; i++) {
    for (int j = 0; j <= k; j++) {
      dp[i][j] += sum[i - 1][j];
      if (j - a[i] - 1 >= 0) dp[i][j] -= sum[i - 1][j - a[i] - 1];
      sum[i][j] += sum[i][j - 1] + dp[i][j];
    }
  }
  cout << dp[n][k] << endl;
}
