#  --*-coding:utf-8-*--

MOD = 10**9 + 7

def getModInv(a, b):
    return 1 if (a == 1) else (1-b*getModInv(b%a, a))//a%b


N, K = map(int, input().split())
t1, t2 = 1,1
s1, s2 = 1,1

for m in range(1, min(K, N-1)+1):
    t1 = t1*(N-m)*(N-m+1)%MOD
    t2 = t2*m**2%MOD

    s1 = (s1*t2 + s2*t1)%MOD
    s2 = s2*t2%MOD

print(s1*getModInv(s2, MOD)%MOD)
 MOD = 10**9 + 7 MOD 10**9 + 7 10**9 10 9 7 def getModInv(a, b):
    return 1 if (a == 1) else (1-b*getModInv(b%a, a))//a%b getModInv return 1 if (a == 1) else (1-b*getModInv(b%a, a))//a%b 1 if (a == 1) else (1-b*getModInv(b%a, a))//a%b a == 1 a 1 1 (1-b*getModInv(b%a, a))//a%b (1-b*getModInv(b%a, a))//a 1-b*getModInv(b%a, a) 1 b*getModInv(b%a, a) b getModInv(b%a, a) getModInv b%a b a a a b a a b b N, K = map(int, input().split()) N map(int, input().split()) map int input().split() ().split () input split K t1, t2 = 1,1 t1 1 t2 1 s1, s2 = 1,1 s1 1 s2 1 for m in range(1, min(K, N-1)+1):
    t1 = t1*(N-m)*(N-m+1)%MOD
    t2 = t2*m**2%MOD

    s1 = (s1*t2 + s2*t1)%MOD
    s2 = s2*t2%MOD m range(1, min(K, N-1)+1) range 1 min(K, N-1)+1 min(K, N-1) min K N-1 N 1 1 t1 = t1*(N-m)*(N-m+1)%MOD t1 t1*(N-m)*(N-m+1)%MOD t1*(N-m)*(N-m+1) t1*(N-m) t1 N-m N m N-m+1 N-m N m 1 MOD t2 = t2*m**2%MOD t2 t2*m**2%MOD t2*m**2 t2 m**2 m 2 MOD s1 = (s1*t2 + s2*t1)%MOD s1 (s1*t2 + s2*t1)%MOD s1*t2 + s2*t1 s1*t2 s1 t2 s2*t1 s2 t1 MOD s2 = s2*t2%MOD s2 s2*t2%MOD s2*t2 s2 t2 MOD print(s1*getModInv(s2, MOD)%MOD) print s1*getModInv(s2, MOD)%MOD s1*getModInv(s2, MOD) s1 getModInv(s2, MOD) getModInv s2 MOD MOD t2 = t2*m**2%MOD t2*m**2%MOD t2 s2 = 1,1 1 s2 K = map(int, input().split()) map(int, input().split()) K def getModInv(a, b):
    return 1 if (a == 1) else (1-b*getModInv(b%a, a))//a%b def getModInv(a, b):
    return 1 if (a == 1) else (1-b*getModInv(b%a, a))//a%b getModInv s1 = (s1*t2 + s2*t1)%MOD (s1*t2 + s2*t1)%MOD s1 MOD = 10**9 + 7 10**9 + 7 MOD t1, t2 = 1,1 1 t1 N, K = map(int, input().split()) map(int, input().split()) N t2 = 1,1 1 t2 t1 = t1*(N-m)*(N-m+1)%MOD t1*(N-m)*(N-m+1)%MOD t1 s2 = s2*t2%MOD s2*t2%MOD s2 s1, s2 = 1,1 1 s1
#  --*-coding:utf-8-*--

MOD = 10**9 + 7

def getModInv(a, b):
    return 1 if (a == 1) else (1-b*getModInv(b%a, a))//a%b


N, K = map(int, input().split())
t1, t2 = 1,1
s1, s2 = 1,1

for m in range(1, min(K, N-1)+1):
    t1 = t1*(N-m)*(N-m+1)%MOD
    t2 = t2*m**2%MOD

    s1 = (s1*t2 + s2*t1)%MOD
    s2 = s2*t2%MOD

print(s1*getModInv(s2, MOD)%MOD)

