def binomialCoefficient(n, k): 
    if(k > n - k): 
        k = n - k 
    res = 1
    for i in range(k): 
        res = (res) * (n - i)
        # res %=m 
        res = res / (i + 1)
        # res %=m 
    return res


N,K = [int(c) for c in input().strip().split(' ')]
arr = [int(c) for c in input().strip().split(' ')]

m = 10**9+7
ans = binomialCoefficient(N+K-1,K)
# print(ans)
_sum = 0
ans = ans%m
for i in range(0,N):
    _sum=arr[i]+1
    if K>=_sum:
        ans-=binomialCoefficient(N+K-_sum-1,N-1)%m
        ans%=m

print(ans%m)