#include <bits/stdc++.h>
using namespace std;
long long n, k;
long long a[101];
long long dp[100001][101];
long long o[100001][101];
void pro(long long c, long long i) {
  if (i == 0) {
    if (c <= a[i])
      dp[c][i] = 1;
    else
      dp[c][i] = 0;
  } else {
    long long j;
    for (j = 0; j < min(c, a[i]) + 1; j++) {
      if (o[c - j][i - 1] == 0) pro(c - j, i - 1);
      dp[c][i] += dp[c - j][i - 1];
    }
  }
  o[c][i] = 1;
  cerr << "c"
       << ":" << c << " | "
       << "i"
       << ": " << i << " | "
       << "dp[c][i]"
       << ": " << dp[c][i] << "\n";
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long i, j;
  cin >> n >> k;
  for (i = 0; i < n; i++) cin >> a[i];
  pro(k, n - 1);
  cout << dp[k][n - 1];
}
