#include <bits/stdc++.h>
using namespace std;
std::vector<long long int> arr;
long long int n;
vector<long long int> ans;
long long int dp(long long int person, long long int total) {
  if (person >= n && total != 0) return 0;
  if (total < 0) return 0;
  if (total == 0) return 1;
  if (ans[person] != -1) return ans[person];
  long long int count = 0;
  for (long long int i = 0; i <= arr[person]; i++) {
    count += dp(person + 1, total - i);
  }
  ans[person] = count;
  return count;
}
int main() {
  long long int k;
  cin >> n >> k;
  arr.resize(n);
  ans.resize(n, -1);
  for (long long int i = 0; i < n; i++) {
    cin >> arr[i];
  }
  cout << dp(0, k);
  return 0;
}
