#include <bits/stdc++.h>
using namespace std;
int num_way_candy_dstrbute(vector<int> &candies, int total_candies) {
  vector<vector<int>> dp(total_candies + 1, vector<int>(candies.size(), 0));
  for (int ci = 0; ci < dp[0].size(); ci++) {
    for (int ri = 0; ri < dp.size(); ri++) {
      if (ri == 0) {
        dp[ri][ci] = 1;
      } else {
        if (ci == 0) {
          dp[ri][ci] = (ri > candies[ci]) ? 0 : 1;
        } else {
          int max_allowed_candy = min(ri, candies[ci]);
          int candy_curr_alloc = 0;
          int num_ways = 0;
          while (candy_curr_alloc <= max_allowed_candy) {
            num_ways += dp[ri - candy_curr_alloc][ci - 1];
            candy_curr_alloc++;
          }
          dp[ri][ci] = num_ways;
        }
      }
    }
  }
  return dp[dp.size() - 1][dp[0].size() - 1];
}
int main() {
  int n, k, temp;
  cin >> n;
  cin >> k;
  vector<int> candies;
  for (int i = 0; i < n; i++) {
    cin >> temp;
    candies.push_back(temp);
  }
  cout << num_way_candy_dstrbute(candies, k);
  return 0;
}
