#include <bits/stdc++.h>
using namespace std;
int n, K;
int dp[110][100100];
int A[110];
int solve(int id, int k) {
  if (dp[id][k] != -1) return dp[id][k];
  if (id == (n)) {
    if (k == K)
      return dp[id][k] = 1;
    else
      return dp[id][k] = 0;
  }
  int res = 0;
  for (int i = 0; i <= A[id]; i++) {
    res += solve(id + 1, k + i);
  }
  return dp[id][k] = res;
}
int main() {
  cin >> n >> K;
  memset(dp, -1, sizeof(dp));
  for (int i = 0; i < n; i++) {
    cin >> A[i];
  }
  cout << solve(0, 0) << endl;
}
