#include <bits/stdc++.h>
using namespace std;
long long int maxcandypossible(long long int *arr, int n, int k) {
  long long int DP[n + 1][k + 1];
  for (int i = 1; i <= k; i++) DP[0][i] = 0;
  for (int i = 0; i <= n; i++) DP[i][0] = 1;
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= k; j++) {
      DP[i][j] = 0;
      for (int x = 0; x <= arr[i - 1]; x++)
        if ((-x + j) >= 0) DP[i][j] += DP[i - 1][-x + j];
    }
  }
  return DP[n][k];
}
int main() {
  int n, k;
  cin >> n >> k;
  long long int arr[n];
  for (int i = 0; i < n; i++) cin >> arr[i];
  cout << maxcandypossible(arr, n, k) << endl;
  return 0;
}
