#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cout.precision(15);
  long long int n, k;
  cin >> n >> k;
  vector<long long int> a(n);
  for (long long int i = 0; i < n; i++) cin >> a[i];
  long long int dp[n + 1][k + 1];
  for (long long int i = 0; i < n + 1; i++) {
    for (long long int j = 0; j < k + 1; j++) {
      if (i == 0 && j == 0)
        dp[i][j] = 1;
      else if (j == 0)
        dp[i][j] = 1;
      else if (i == 0)
        dp[i][j] = 0;
      else {
        dp[i][j] = 0;
        for (long long int h = 0; h < a[i - 1] + 1; h++) {
          if (j - h >= 0) dp[i][j] += dp[i - 1][j - h];
        }
      }
    }
  }
  cout << dp[n][k];
}
