#include <bits/stdc++.h>
using namespace std;
long long int dp[105][100005];
int main() {
  std::ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  memset(dp, 0, sizeof(dp));
  long long int n, k;
  cin >> n >> k;
  long long int arr[1 + n];
  for (long long int i = 0; i < n; i++) {
    cin >> arr[i];
  }
  for (long long int i = n - 1; i >= 0; i--) {
    for (long long int j = 0; j <= k; j++) {
      if (i == n - 1) {
        if (j >= 0 and j <= arr[i]) {
          dp[i][j] = 1;
        }
      } else {
        for (long long int u = 0; u <= min(j, arr[i]); u++) {
          dp[i][j] += dp[i + 1][j - u];
        }
      }
    }
  }
  cout << dp[0][k] << '\n';
}
