#include <bits/stdc++.h>
using namespace std;
long long a[101], f[101][100001], s[101];
int main() {
  long long i, j, n, k, l, a1;
  scanf("%lld %lld", &n, &k);
  for (i = 1; i <= n; i++) {
    scanf("%lld", &a[i]);
  }
  f[0][0] = 1;
  for (i = 1; i <= n; i++) {
    s[0] = 1;
    for (a1 = 1; a1 <= k; a1++) {
      s[a1] = s[a1 - 1] + f[i - 1][a1];
    }
    for (j = 0; j <= k; j++) {
      if (j - a[i] >= 0)
        f[i][j] = s[j] - s[j - a[i] - 1];
      else
        f[i][j] = s[j];
    }
  }
  printf("%lld", f[n][k]);
  return 0;
}
