M=10**9+7

(n,k)=gets.split.map(&:to_i)

fact = [1]

(1..n).each{|i|
    fact[i] = fact[i-1]*i
}
b=k
r=n-k

(1..k).each{|i|
    r0 = r - (i-1)
    b0 = b - i
    r=  (fact[r0+i]/(fact[i]*fact[r0])) *  (fact[b0+i-1]/(fact[i-1]*fact[b0])) % M
    p r
}