import sys sys.setrecursionlimit(10 ** 6) def MI(): return map(int, sys.stdin.readline().split()) def main(): md = 10 ** 9 + 7 n,k=MI() MI() dp=[[0]*(k+1) for _ in range(n+1)] dp[0][0]=1 for i in range(n): s=0 w=n-i for j in range(k+1): s+=dp[i][j] if j-w>=0:s-=dp[i][j-w] s%=md dp[i+1][j]=s print(sum(dp[n])%md) main()