#include <bits/stdc++.h>
using namespace std;
long long int MAX_CHARS = 10000;
const long long int mod = 1e9 + 7;
const long long int INF = LONG_LONG_MAX;
inline long long int gcd(long long int a, long long int b) {
  if (a == 0) return b;
  return gcd(b % a, a);
}
inline long long int pow(long long int a, long long int n, long long int mod) {
  if (n == 0) return 1;
  long long int p = pow(a, n / 2, mod);
  p = (p % mod * p % mod) % mod;
  if (n % 2)
    return (p % mod * a % mod) % mod;
  else
    return p;
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long int n, k;
  cin >> n >> k;
  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; i++) {
    for (long long int j = 0; j <= k; j++) {
      dp[i][j] = 0;
      if (j == 0) {
        dp[i][j] = 1;
        continue;
      }
      if (i == 0) {
        dp[i][j] = 0;
        continue;
      }
      for (long long int k = 0; k <= a[i - 1]; k++) {
        if (j - k < 0) break;
        dp[i][j] += dp[i - 1][j - k];
      }
    }
  }
  cout << dp[n][k] << "\n";
  return 0;
}
