//
//  main.cpp
//  atcoder-candies
//
//  Created by r on 6/1/19.
//  Copyright © 2019 r. All rights reserved.
//

#include <iostream>
#include <algorithm>
#include <cstring>
#include <iomanip>
#include <fstream>
#include <cmath>
#include <vector>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <map>
#include <stack>
#include <queue>
#include <assert.h>
#include <limits>
#include <cstdio>
using namespace std;

//#define RDEBUG 1
#ifdef RDEBUG
#define D(x) x
#else
#define D(x)
#endif
#define inf 0x7fffffff
#define MOD 1000000007

long long N,K;
long long pref[100010];
long long currpref[100010];
long long dp[110][100010];
long long a[100010];

int main() {
    ios_base :: sync_with_stdio(false);
    cin.tie(nullptr);
    cin >> N >> K;
    for (long long i = 1; i<=N; i++) {
        cin >> a[i];
    }
    dp[0][0] = 1;
    for (long long i = 0; i<=K; i++) {
        pref[i+1]+=pref[i];
        pref[i+1]+=dp[0][i];
    }
    for (long long i = 1; i<=N; i++) {
        for (long long j = 0; j<=K; j++) {
            dp[i][j] = pref[j+1]-pref[max(0, j-a[i])];
            currpref[j+1]+=currpref[j];
            currpref[j+1]+=dp[i][j];
        }
        memcpy(pref, currpref, sizeof(pref));
        memset(currpref, 0, sizeof(currpref));
    }
    cout << dp[N][K] << endl;
    return 0;
}



