def comb_list(n, r, mod):
    ret = [1]
    for i in range(1, r+1):
        ret.append(ret[-1] * (n+1-i) * pow(i, mod-2, mod) % mod)
    return ret

n,k = map(int,input().split())
mod = 10**9+7

r = min(k,n-1)
ans = 0
nCl = comb_list(n, r, mod)
n1Cl = comb_list(n-1, r, mod)

for i in range(r+1):
    ans = (ans + nCl[i] * n1Cl[i]) % mod

print(ans) def comb_list(n, r, mod):
    ret = [1]
    for i in range(1, r+1):
        ret.append(ret[-1] * (n+1-i) * pow(i, mod-2, mod) % mod)
    return ret comb_list ret = [1] ret [1] 1 for i in range(1, r+1):
        ret.append(ret[-1] * (n+1-i) * pow(i, mod-2, mod) % mod)
     i range(1, r+1) range 1 r+1 r 1 ret.append(ret[-1] * (n+1-i) * pow(i, mod-2, mod) % mod) ret.append ret append ret[-1] * (n+1-i) * pow(i, mod-2, mod) % mod ret[-1] * (n+1-i) * pow(i, mod-2, mod) ret[-1] * (n+1-i) ret[-1] ret -1 n+1-i n+1 n 1 i pow(i, mod-2, mod) pow i mod-2 mod 2 mod mod return ret ret n n r r mod 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 r = min(k,n-1) r min(k,n-1) min k n-1 n 1 ans = 0 ans 0 nCl = comb_list(n, r, mod) nCl comb_list(n, r, mod) comb_list n r mod n1Cl = comb_list(n-1, r, mod) n1Cl comb_list(n-1, r, mod) comb_list n-1 n 1 r mod for i in range(r+1):
    ans = (ans + nCl[i] * n1Cl[i]) % mod i range(r+1) range r+1 r 1 ans = (ans + nCl[i] * n1Cl[i]) % mod ans (ans + nCl[i] * n1Cl[i]) % mod ans + nCl[i] * n1Cl[i] ans nCl[i] * n1Cl[i] nCl[i] nCl i n1Cl[i] n1Cl i mod print(ans) print ans r = min(k,n-1) min(k,n-1) r mod = 10**9+7 10**9+7 mod nCl = comb_list(n, r, mod) comb_list(n, r, mod) nCl def comb_list(n, r, mod):
    ret = [1]
    for i in range(1, r+1):
        ret.append(ret[-1] * (n+1-i) * pow(i, mod-2, mod) % mod)
    return ret def comb_list(n, r, mod):
    ret = [1]
    for i in range(1, r+1):
        ret.append(ret[-1] * (n+1-i) * pow(i, mod-2, mod) % mod)
    return ret comb_list n,k = map(int,input().split()) map(int,input().split()) n k = map(int,input().split()) map(int,input().split()) k ans = (ans + nCl[i] * n1Cl[i]) % mod (ans + nCl[i] * n1Cl[i]) % mod ans ans = 0 0 ans n1Cl = comb_list(n-1, r, mod) comb_list(n-1, r, mod) n1Cl
def comb_list(n, r, mod):
    ret = [1]
    for i in range(1, r+1):
        ret.append(ret[-1] * (n+1-i) * pow(i, mod-2, mod) % mod)
    return ret

n,k = map(int,input().split())
mod = 10**9+7

r = min(k,n-1)
ans = 0
nCl = comb_list(n, r, mod)
n1Cl = comb_list(n-1, r, mod)

for i in range(r+1):
    ans = (ans + nCl[i] * n1Cl[i]) % mod

print(ans)
