import java.io.*;
import java.util.*;

class Main {
    static final long MOD = 1000000007;

    // Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
    public static void main(String[] args) throws Exception {
        final Scanner sc = new Scanner(System.in);
        long N;
        N = sc.nextLong();
        long K;
        K = sc.nextLong();
        long[] a = new long[(int)(N)];
        for(int i = 0 ; i < N ; i++){
                a[i] = sc.nextLong();
        }
        solve(N, K, a);
    }

    static void solve(long N, long K, long[] a){
        long[][] dp = new long[(int)N][(int)(K+1)];
        
        for (int i = 0; i <= a[0]; i++){
            dp[0][i] = 1;
        }

        for (int i = 1; i < N; i++){
            for (int j = 0; j <= K; j++){
                long sum = 0;
                for (int k = 0; k <= a[i]; k++){
                    if (j >= k){
                        sum = (sum + dp[i-1][j-k]) % MOD;
                    }
                }
                dp[i][j] = sum;
            }
        }

        System.out.print(dp[(int)(N-1)][(int)(K)]);
    }
}
