#include <bits/stdc++.h>
using namespace std;
vector<int> arr(101);
int k;
int n;
long long dp[101][100001] = {0};
long long solve() {
  for (int j = 0; j <= k; j++) {
    dp[1][j] = (j > arr[1]) ? 0 : 1;
  }
  for (int i = 2; i <= n; i++) {
    dp[i][0] = dp[i - 1][0];
    for (int j = 1; j < k + 1; j++) {
      dp[i][j] = dp[i][j - 1] + dp[i - 1][j] -
                 ((j - 1 - arr[i] >= 0) ? dp[i - 1][j - 1 - arr[i]] : 0);
    }
  }
  return dp[n][k];
}
int main() {
  cin >> n >> k;
  for (int i = 1; i < n + 1; i++) cin >> arr[i];
  cout << solve() << '\n';
}
