#include<cstdio>
#include<algorithm>
#include<cstring>
#define maxn 101
#define mod 1000007
using namespace std;
int d[maxn][maxn]={0};
int n,m;
int a[maxn]={0};
int main(){
freopen("flower.in","r",stdin);
freopen("flower.out","w",stdout);
scanf("%d%d",&n,&m);
for (int i=1;i<=n;i++){
scanf("%d",&a[i]);
}
d[0][0]=1;
for (int i=1;i<=n;i++){
d[i][0]=1;
for (int j=1;j<=m;j++){
for (int k=max(j-a[i],0);k<=j;k++){
d[i][j]=(d[i][j]+d[i-1][k])%mod;
}
}
}
printf("%d",d[n][m]);
return 0;
}