#include <bits/stdc++.h>
using namespace std;
void solve() {
  long long n, k;
  cin >> n >> k;
  long long arr[n];
  for (long long i = 0; i < n; ++i) cin >> arr[i];
  vector<vector<long long>> dp(n + 1, vector<long long>(k + 1, 0));
  for (long long i = 0; i < n + 1; ++i) dp[i][0] = 1;
  for (long long i = 1; i < n + 1; ++i) {
    for (long long j = 1; j < k + 1; ++j) {
      for (long long m = 0; m < min(arr[i - 1], j) + 1; ++m)
        dp[i][j] += dp[i - 1][j - m];
    }
  }
  cout << dp[n][k];
}
int main() {
  std::ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int T = 1;
  while (T--) solve();
  return 0;
}
