#include <bits/stdc++.h>
using namespace std;
static const int maxn = 100 + 5;
static const long long int mod = 1e9 + 7;
int children;
int candies;
int have[maxn];
long long int dp[100 + 5][100000 + 5];
bool memoize[100 + 5][100000 + 5];
inline long long int solve(int child, int rem_candies) {
  if (child > children) return rem_candies == 0;
  if (rem_candies < 0) return 0;
  long long int &ret = dp[child][rem_candies];
  bool &mem = memoize[child][rem_candies];
  if (mem) return ret;
  mem = 1;
  ret = 0;
  for (int i = 0; i <= have[child]; i++)
    ret = (ret + solve(child + 1, rem_candies - i));
  return ret;
}
int main() {
  cin >> children;
  cin >> candies;
  for (int i = 1; i <= children; i++) cin >> have[i];
  cout << solve(1, candies);
}
