#include <bits/stdc++.h>
using namespace std;
vector<int> a;
int f[102][100002] = {0};
int main() {
  int n, k;
  int i, j, l;
  scanf("%d %d", &n, &k);
  a.resize(n + 1);
  for (i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
  }
  f[0][0] = 1;
  for (i = 1; i <= n; i++) {
    for (j = 0; j < k; j++) {
      for (l = 0; l <= min(a[i], j); l++) {
        f[i][j] += f[i - 1][j - l];
      }
    }
  }
  printf("%d\n", f[n][k - 1]);
  return 0;
}
