#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9 + 7;
long long n, k;
long long A[105];
long long F[105][100005];
long long tinh(long long i, long long kk) {
  if (kk > k) return 0;
  if (i > n) {
    if (k == kk)
      return 1;
    else
      return 0;
  }
  if (F[i][kk] != -1) return F[i][kk];
  F[i][kk] = 0;
  for (long long j = 0; j <= A[i]; j++) {
    F[i][kk] += tinh(i + 1, kk + j);
  }
  return F[i][kk];
}
void init() {
  for (long long i = 0; i <= n; i++)
    for (long long j = 0; j <= 100000; j++) {
      F[i][j] = -1;
    }
}
signed main() {
  cin >> n >> k;
  for (long long i = 1; i <= n; i++) {
    cin >> A[i];
  }
  init();
  cout << tinh(1, 0);
  return 0;
}
