#include <bits/stdc++.h>
using namespace std;
int dp[105][1000005];
int solve(int ind, int rem, int arr[], int n) {
  if (ind == n) {
    if (rem == 0)
      return 1;
    else {
      return 0;
    }
  }
  if (dp[ind][rem] != -1) {
    return dp[ind][rem];
  }
  int maxe = arr[ind];
  int res = 0;
  for (int i = 0; i <= maxe; i++) {
    if (rem - i >= 0) res += solve(ind + 1, rem - i, arr, n);
  }
  return dp[ind][rem] = res;
}
int main() {
  int n, k;
  cin >> n >> k;
  int arr[n];
  memset(dp, -1, sizeof(dp));
  for (int i = 0; i < n; i++) {
    cin >> arr[i];
  }
  cout << solve(0, k, arr, n);
  return 0;
}
