#include <bits/stdc++.h>
using namespace std;
const int MOD = 1000000007;
int main() {
  int n, k;
  cin >> n >> k;
  vector<int> a(n);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  vector<vector<long long>> dp(n + 1, vector<long long>(k + 1, 0));
  dp[0][0] = 1;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j <= k; j++) {
      for (int x = 0; x <= a[i]; x++) {
        if (j + x > k) {
          continue;
        }
        dp[i + 1][j + x] += dp[i][j];
      }
    }
  }
  cout << dp[n][k] << endl;
  return 0;
}
