nk = input('').split(' ')
n = int(nk[0])+1
k = int(nk[1])

x=1
mod = 10 ** 9 + 7

for i in range(k,n+1):
    p=1
    for j in range(k,i+1):
        p*=j
        p%=mod
    p/=i
    x+=p

print(int(x))
