mod = 10**9+7
n, k = [ int(v) for v in input().split() ]
a_list = [ int(v) for v in input().split() ]

dp_list = [ 0 for i in range(k+1) ]
dp_list[0] = 1

for i in range(n):
    new_dp_list = [ 0 for i in range(k+1) ]
    for j in range(k+1):
        for h in range(a_list[i]+1):
            if j+h <= k:
                new_dp_list[j+h] += dp_list[j]
    dp_list = [ i % mod for i in new_dp_list ]

print(dp_list[-1])