#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
int a[100005], dp[int(105)][100005], n, k;
int solve(int idx, int taken) {
  if (idx == n + 1 && taken == k) return 1;
  if (taken > k || idx > n) return 0;
  if (taken == k) return 1;
  if (dp[idx][taken] != -1) return dp[idx][taken];
  int ans = 0;
  for (int i = 0; i <= a[idx]; i++) ans += solve(idx + 1, taken + i);
  return dp[idx][taken] = ans;
}
int main() {
  ios_base::sync_with_stdio(false), cin.tie(NULL);
  cin >> n >> k;
  memset(dp, -1, sizeof(dp));
  for (int i = 1; i <= n; i++) cin >> a[i];
  cout << solve(1ll, int(0)) << '\n';
  return 0;
}
