#include <bits/stdc++.h>
using namespace std;
int solve(int arr[], int n, int m) {
  int dp[m + 1][n + 1];
  for (int i = 0; i <= m; i++) {
    dp[i][0] = 0;
  }
  for (int i = 0; i <= n; i++) {
    dp[0][i] = 1;
  }
  dp[0][0] = 1;
  for (int d = 1; d <= n; d++) {
    for (int r = 1; r <= m; r++) {
      int sum = 0;
      for (int num = 0; num <= arr[d] && num <= r; num++) {
        sum = sum + dp[r - num][d - 1];
      }
      dp[r][d] = sum;
    }
  }
  return dp[m][n];
}
int main() {
  int n, m;
  cin >> n >> m;
  int *arr = new int[n + 1];
  arr[0] = 0;
  for (int i = 1; i <= n; i++) {
    cin >> arr[i];
  }
  int k = solve(arr, n, m);
  cout << k;
}
