1 #include<cstdio>
2 #include<iostream>
3
4 using namespace std;
5
6 const int maxn = 10005;
7 const int mod = 1000007;
8
9 int n, m;
10 long long a[maxn], dp[maxn][maxn];
11
12 int main(){
13 scanf("%d%d", &n, &m);
14 for(int i = 1; i <= n; i++) scanf("%lld", &a[i]);
15 for(int i = 0; i <= m; i++) dp[i][0] = 1;
16 for(int i = 1; i <= n; i++){
17 for(int j = 1; j <= m; j++){
18 for(int k = j; k >= j - a[i]; k--){
19 if(k >= 0){
20 dp[i][j] += dp[i - 1][k] % mod;
21 dp[i][j] %= mod;
22 }
23 else break;
24 }
25 }
26 }
27 printf("%lld
", dp[n][m]);
28 return 0;
29 }