#include <bits/stdc++.h>
using namespace std;
template <typename T>
void chmax(T& a, T b) {
  a = max(a, b);
}
template <typename T>
void chmin(T& a, T b) {
  a = min(a, b);
}
template <class X>
void swp(X& a, X& b) {
  X c;
  c = a;
  a = b;
  b = c;
}
using ll = long long int;
using ull = unsigned long long int;
ll ModE(ll x, ull y, ll p = 1000000007) {
  ll res = 1;
  x = x % p;
  while (y > 0) {
    if (y & 1) res = (res * x) % p;
    y = y >> 1;
    x = (x * x) % p;
  }
  return res;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  ll n, k;
  cin >> n >> k;
  ll dp[n + 1][k + 1];
  for (int i = 0; i <= k; i++) dp[0][i] = 0;
  for (int i = 0; i <= n; i++) dp[i][0] = 1;
  int p;
  for (int i = 1; i <= n; i++) {
    cin >> p;
    for (int j = 0; j <= k; j++) {
      dp[i][j] = 0;
      for (int l = 0; l <= min(p, j) && j - l >= 0; l++) {
        dp[i][j] += dp[i - 1][j - l];
      }
    }
  }
  cout << dp[n][k];
  return 0;
}
