n, k = map(int, input().split())
mod = 10**9+7
g1 = [1, 1]
g2 = [1, 1]
inv = [0, 1]
for i in range(2, n+1):
    g1.append((g1[-1] * i) % mod)
    inv.append((-inv[mod%i] * (mod//i)) % mod)
    g2.append((g2[-1] * inv[-1]) % mod)

def comb(n, r):
    if r<0 or r>n:
        return 0
    return g1[n] * g2[r] * g2[n-r] % mod

li = []
for i in range(min(k, n-1)+1):
    li.append(comb(n-1, i))
ans = 0
pre = 0
for cur in li:
    ans += (pre+cur)*cur
    pre = cur
print(ans%mod) n, k = map(int, input().split()) n map(int, input().split()) map int input().split() ().split () input split k mod = 10**9+7 mod 10**9+7 10**9 10 9 7 g1 = [1, 1] g1 [1, 1] 1 1 g2 = [1, 1] g2 [1, 1] 1 1 inv = [0, 1] inv [0, 1] 0 1 for i in range(2, n+1):
    g1.append((g1[-1] * i) % mod)
    inv.append((-inv[mod%i] * (mod//i)) % mod)
    g2.append((g2[-1] * inv[-1]) % mod) i range(2, n+1) range 2 n+1 n 1 g1.append((g1[-1] * i) % mod) g1.append g1 append (g1[-1] * i) % mod g1[-1] * i g1[-1] g1 -1 i mod inv.append((-inv[mod%i] * (mod//i)) % mod) inv.append inv append (-inv[mod%i] * (mod//i)) % mod -inv[mod%i] * (mod//i) -inv[mod%i] inv[mod%i] inv mod%i mod i mod//i mod i mod g2.append((g2[-1] * inv[-1]) % mod) g2.append g2 append (g2[-1] * inv[-1]) % mod g2[-1] * inv[-1] g2[-1] g2 -1 inv[-1] inv -1 mod def comb(n, r):
    if r<0 or r>n:
        return 0
    return g1[n] * g2[r] * g2[n-r] % mod comb if r<0 or r>n:
        return 0
     r<0 or r>n r<0 r 0 r>n r n return 0 0 return g1[n] * g2[r] * g2[n-r] % mod g1[n] * g2[r] * g2[n-r] % mod g1[n] * g2[r] * g2[n-r] g1[n] * g2[r] g1[n] g1 n g2[r] g2 r g2[n-r] g2 n-r n r mod n n r r li = [] li [] for i in range(min(k, n-1)+1):
    li.append(comb(n-1, i)) i range(min(k, n-1)+1) range min(k, n-1)+1 min(k, n-1) min k n-1 n 1 1 li.append(comb(n-1, i)) li.append li append comb(n-1, i) comb n-1 n 1 i ans = 0 ans 0 pre = 0 pre 0 for cur in li:
    ans += (pre+cur)*cur
    pre = cur cur li ans += (pre+cur)*cur ans (pre+cur)*cur pre+cur pre cur cur pre = cur pre cur print(ans%mod) print ans%mod ans mod g2 = [1, 1] [1, 1] g2 def comb(n, r):
    if r<0 or r>n:
        return 0
    return g1[n] * g2[r] * g2[n-r] % mod def comb(n, r):
    if r<0 or r>n:
        return 0
    return g1[n] * g2[r] * g2[n-r] % mod comb k = map(int, input().split()) map(int, input().split()) k g1 = [1, 1] [1, 1] g1 n, k = map(int, input().split()) map(int, input().split()) n li = [] [] li inv = [0, 1] [0, 1] inv ans = 0 0 ans pre = cur cur pre pre = 0 0 pre mod = 10**9+7 10**9+7 mod ans += (pre+cur)*cur (pre+cur)*cur ans
n, k = map(int, input().split())
mod = 10**9+7
g1 = [1, 1]
g2 = [1, 1]
inv = [0, 1]
for i in range(2, n+1):
    g1.append((g1[-1] * i) % mod)
    inv.append((-inv[mod%i] * (mod//i)) % mod)
    g2.append((g2[-1] * inv[-1]) % mod)

def comb(n, r):
    if r<0 or r>n:
        return 0
    return g1[n] * g2[r] * g2[n-r] % mod

li = []
for i in range(min(k, n-1)+1):
    li.append(comb(n-1, i))
ans = 0
pre = 0
for cur in li:
    ans += (pre+cur)*cur
    pre = cur
print(ans%mod)