#include <bits/stdc++.h>
const long long mxn = 4 * 1e5 + 3;
const long long mod = 1e8 + 7;
const long long inf = 1e18 + 9;
using namespace std;
long long a[mxn], n, dp[1001][1001], cnt = 0, m;
int main() {
  ios_base::sync_with_stdio(0), cout.tie(0);
  cin.tie(0);
  cin >> n >> m;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
  }
  dp[0][0] = 1;
  for (int i = 1; i <= n; i++) {
    for (int j = 0; j <= m; j++) {
      dp[i][j] = dp[i - 1][j];
      for (int k = 1; k <= min(j, (int)a[i]); k++) {
        dp[i][j] += dp[i - 1][j - k];
      }
    }
  }
  cout << dp[n][m];
  return 0;
}
