/** e==m*pow(c,2) **/
#include <bits/stdc++.h>
using namespace std;
#define DEBUG 0
#define LL long long
#define int long long
#define pii pair<int, int>
#define SQR(n) (n*n)
#define pb push_back
#define endl '\n'
#define yes cout << "YES" << endl
#define no cout << "NO" << endl
#define INF 100000000000
#define PI (acos(0.0) * 2.0)
#define time_start clock_t tStart = clock()
#define time_end (double)(clock() - tStart)/CLOCKS_PER_SEC
#define maxn 100009
//#pragma GCC diagnostic warning "-std=c++11"
#define check(n, i) (int)(bool(!((n)&(1<<(i)))))
#define set(n, i) (((n)|(1<<(i))))
#define mod 1000000007
 
#define dbg(a) cout << #a << " = " << a << endl;

 
void faster(void)
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
}
 
int lcm(int a, int b)
{
    return (a*b) / __gcd(a, b);
} 
 

int i, j, ara[105], n, k;
int dp[105][100005];

int cumsum(int v, int st, int en)
{
    if(!st) return dp[v][en];
    return dp[v][en]-dp[v][st-1];
}

int fak(int x, int y)
{
    if(y>ara[x]) return 0;
    int sum=cumsum(x-1, max(0LL, y-(ara[x]-ara[x-1])), y);
    //cout<<x<<' '<<y<<' '<<ara[x]<<" ST "<<max(0LL, y-(ara[x]-ara[x-1]))<<' '<<"EN "<<y<<' '<<sum<<endl;
    return sum;
}


int32_t main()
{
    #ifdef ONPC
      freopen("in.txt", "r", stdin);
      freopen("out.txt", "w", stdout);
    #endif
    faster();
    cin >> n >> k;
    for(i=0;i<=100;i++) dp[i][0]=1;
    for(i=1;i<=n;i++) cin>>ara[i];
    for(j=1;j<=k;j++) dp[0][j] += dp[0][j-1];
    for(i=1;i<=n;i++)
    {
        ara[i]+=ara[i-1];
        for(j=1;j<=k;j++)
        {
            dp[i][j] = fak(i, j)%mod;
        }
        //cout<<i<<endl<<flush;
        //for(j=1;j<=k;j++) cout<<dp[i][j]<<' ';
            //cout<<endl;
        for(j=1;j<=k;j++) dp[i][j] += dp[i][j-1], dp[i][j]%=mod;
    }
    if(DEBUG)
    {
        for(i=0;i<=n;i++)
        {
            for(j=0;j<=k;j++) cout<<dp[i][j]<<' ';
            cout<<endl;
        }
        cout<<endl;
    }
    cout<<dp[n][k]-dp[n][k-1]<<endl;
    return 0;
}
