#include <bits/stdc++.h>
const int N = 1e5 + 100;
const int M = 1e6 + 100;
const long long oo = 2e18;
long long n, m, k, t, q, h, a, b, d, c, e, w, x, y, z;
using namespace std;
int ar[109];
int dp[109][100005];
int main() {
  cin >> n >> k;
  for (int i = 1; i <= n; i++) {
    cin >> ar[i];
  }
  for (int i = 0; i <= n; i++) {
    dp[i][0] = 1;
  }
  for (int i = 1; i <= k; i++) {
    dp[0][i] = -1;
  }
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= k; j++) {
      long long e = -1;
      for (int r = 0; r <= ar[i]; r++) {
        if (r > j) continue;
        if (e == -1) {
          e = dp[i - 1][j - r];
        } else
          e += dp[i - 1][j - r];
      }
      dp[i][j] = e;
    }
  }
  cout << (dp[n][k] == -1 ? 0 : dp[n][k]) << endl;
  return 0;
}
