from sys import setrecursionlimit
setrecursionlimit(1<<30)
def f(i,k,s,d):
    if i==n:
        return k==0
    if k<0 or k-s>0:
        return 0
    if (i,k) not in d:
        d[i,k]=sum(f(i+1,k-j,s-j,d) for j in xrange(a[i]+1))%(pow(10,9)+7)
    return d[i,k]
n,k=map(int,raw_input().split())
a=map(int,raw_input().split())
print f(0,k,sum(a),{})