#include <bits/stdc++.h>
using namespace std;
const long long inf = 1e16;
const long long _inf = -1e16;
long long dx[] = {1, -1, 0, 0};
long long dy[] = {0, 0, 1, -1};
long long addmod(long long& a, long long b) {
  a += b;
  if (a >= 1000000007) a -= 1000000007;
}
long long submod(long long& a, long long b) {
  a -= b;
  if (a < 0) a += 1000000007;
}
long long dp[105][100005];
long long a[100005];
long long pre[105][100005];
int main() {
  long long n, k, i, j, can;
  cin >> n >> can;
  for (i = 1; i <= n; i++) cin >> a[i];
  dp[0][0] = 1;
  pre[0][0] = 1;
  for (i = 1; i <= can; i++) dp[0][i] = 0, pre[0][i] = 0;
  for (i = 1; i <= n; i++) dp[i][0] = 1, pre[i][0] = 1;
  for (i = 1; i <= n; i++) {
    for (j = 1; j <= can; j++) {
      if (j - a[i] > 0)
        dp[i][j] = pre[i - 1][j] - pre[i - 1][j - a[i] - 1];
      else
        dp[i][j] = pre[i - 1][j];
      pre[i][j] = pre[i][j - 1] + dp[i][j];
    }
  }
  cout << pre[n][can] << endl;
  return 0;
}
