MOD = 1000000007  # type: int
 
def solve(n: int, k: int):
    fact = [1] * (n+1)
    inv_fact = [1] * (n+1)
    for i in range(1, n+1):
        fact[i] = i*fact[i-1] % MOD
 
    inv_fact[-1] = pow(fact[-1], MOD-2, MOD)
    for i in range(n-1, 0, -1):
        inv_fact[i] = inv_fact[i+1] * (i+1) % MOD
 
    def comb(n, r, MOD=MOD):
        return fact[n] * inv_fact[n-r] * inv_fact[r] % MOD
    
    ans = 0
    for i in range(min(k, n-1)+1):
        ans += comb(n, i) * comb(n-1, i) % MOD
        ans %= MOD
 
    return ans

n, k = list(map(int, input().split()))

print(solve(n, k)) MOD = 1000000007 MOD 1000000007 def solve(n: int, k: int):
    fact = [1] * (n+1)
    inv_fact = [1] * (n+1)
    for i in range(1, n+1):
        fact[i] = i*fact[i-1] % MOD
 
    inv_fact[-1] = pow(fact[-1], MOD-2, MOD)
    for i in range(n-1, 0, -1):
        inv_fact[i] = inv_fact[i+1] * (i+1) % MOD
 
    def comb(n, r, MOD=MOD):
        return fact[n] * inv_fact[n-r] * inv_fact[r] % MOD
    
    ans = 0
    for i in range(min(k, n-1)+1):
        ans += comb(n, i) * comb(n-1, i) % MOD
        ans %= MOD
 
    return ans solve fact = [1] * (n+1) fact [1] * (n+1) [1] 1 n+1 n 1 inv_fact = [1] * (n+1) inv_fact [1] * (n+1) [1] 1 n+1 n 1 for i in range(1, n+1):
        fact[i] = i*fact[i-1] % MOD
 
     i range(1, n+1) range 1 n+1 n 1 fact[i] = i*fact[i-1] % MOD fact[i] fact i i*fact[i-1] % MOD i*fact[i-1] i fact[i-1] fact i-1 i 1 MOD inv_fact[-1] = pow(fact[-1], MOD-2, MOD) inv_fact[-1] inv_fact -1 pow(fact[-1], MOD-2, MOD) pow fact[-1] fact -1 MOD-2 MOD 2 MOD for i in range(n-1, 0, -1):
        inv_fact[i] = inv_fact[i+1] * (i+1) % MOD
 
     i range(n-1, 0, -1) range n-1 n 1 0 -1 inv_fact[i] = inv_fact[i+1] * (i+1) % MOD inv_fact[i] inv_fact i inv_fact[i+1] * (i+1) % MOD inv_fact[i+1] * (i+1) inv_fact[i+1] inv_fact i+1 i 1 i+1 i 1 MOD def comb(n, r, MOD=MOD):
        return fact[n] * inv_fact[n-r] * inv_fact[r] % MOD
    
     comb return fact[n] * inv_fact[n-r] * inv_fact[r] % MOD fact[n] * inv_fact[n-r] * inv_fact[r] % MOD fact[n] * inv_fact[n-r] * inv_fact[r] fact[n] * inv_fact[n-r] fact[n] fact n inv_fact[n-r] inv_fact n-r n r inv_fact[r] inv_fact r MOD n n r r MOD=MOD MOD MOD ans = 0 ans 0 for i in range(min(k, n-1)+1):
        ans += comb(n, i) * comb(n-1, i) % MOD
        ans %= MOD
 
     i range(min(k, n-1)+1) range min(k, n-1)+1 min(k, n-1) min k n-1 n 1 1 ans += comb(n, i) * comb(n-1, i) % MOD ans comb(n, i) * comb(n-1, i) % MOD comb(n, i) * comb(n-1, i) comb(n, i) comb n i comb(n-1, i) comb n-1 n 1 i MOD ans %= MOD ans MOD return ans ans n: int n k: int k n, k = list(map(int, input().split())) n list(map(int, input().split())) list map(int, input().split()) map int input().split() ().split () input split k print(solve(n, k)) print solve(n, k) solve n k MOD = 1000000007 1000000007 MOD k = list(map(int, input().split())) list(map(int, input().split())) k n, k = list(map(int, input().split())) list(map(int, input().split())) n def solve(n: int, k: int):
    fact = [1] * (n+1)
    inv_fact = [1] * (n+1)
    for i in range(1, n+1):
        fact[i] = i*fact[i-1] % MOD
 
    inv_fact[-1] = pow(fact[-1], MOD-2, MOD)
    for i in range(n-1, 0, -1):
        inv_fact[i] = inv_fact[i+1] * (i+1) % MOD
 
    def comb(n, r, MOD=MOD):
        return fact[n] * inv_fact[n-r] * inv_fact[r] % MOD
    
    ans = 0
    for i in range(min(k, n-1)+1):
        ans += comb(n, i) * comb(n-1, i) % MOD
        ans %= MOD
 
    return ans def solve(n: int, k: int):
    fact = [1] * (n+1)
    inv_fact = [1] * (n+1)
    for i in range(1, n+1):
        fact[i] = i*fact[i-1] % MOD
 
    inv_fact[-1] = pow(fact[-1], MOD-2, MOD)
    for i in range(n-1, 0, -1):
        inv_fact[i] = inv_fact[i+1] * (i+1) % MOD
 
    def comb(n, r, MOD=MOD):
        return fact[n] * inv_fact[n-r] * inv_fact[r] % MOD
    
    ans = 0
    for i in range(min(k, n-1)+1):
        ans += comb(n, i) * comb(n-1, i) % MOD
        ans %= MOD
 
    return ans solve
MOD = 1000000007  # type: int
 
def solve(n: int, k: int):
    fact = [1] * (n+1)
    inv_fact = [1] * (n+1)
    for i in range(1, n+1):
        fact[i] = i*fact[i-1] % MOD
 
    inv_fact[-1] = pow(fact[-1], MOD-2, MOD)
    for i in range(n-1, 0, -1):
        inv_fact[i] = inv_fact[i+1] * (i+1) % MOD
 
    def comb(n, r, MOD=MOD):
        return fact[n] * inv_fact[n-r] * inv_fact[r] % MOD
    
    ans = 0
    for i in range(min(k, n-1)+1):
        ans += comb(n, i) * comb(n-1, i) % MOD
        ans %= MOD
 
    return ans

n, k = list(map(int, input().split()))

print(solve(n, k))