def solve():
    mod = 10**9+7
    n, k = map(int, input().split())
    m = min(n-1,k)
    ans = 1
    dp0 = [1]*(m+1)
    dp1 = [1]*(m+1)
    for i in range(1,m+1):
        dp0[i] = dp0[i-1]*(n-i+1)*pow(i,mod-2,mod)%mod
        dp1[i] = dp1[i-1]*(n-i)*pow(i,mod-2,mod)%mod
        ans += dp0[i]*dp1[i]%mod
        ans %= mod
    return ans
print(solve()) def solve():
    mod = 10**9+7
    n, k = map(int, input().split())
    m = min(n-1,k)
    ans = 1
    dp0 = [1]*(m+1)
    dp1 = [1]*(m+1)
    for i in range(1,m+1):
        dp0[i] = dp0[i-1]*(n-i+1)*pow(i,mod-2,mod)%mod
        dp1[i] = dp1[i-1]*(n-i)*pow(i,mod-2,mod)%mod
        ans += dp0[i]*dp1[i]%mod
        ans %= mod
    return ans solve mod = 10**9+7 mod 10**9+7 10**9 10 9 7 n, k = map(int, input().split()) n map(int, input().split()) map int input().split() ().split () input split k m = min(n-1,k) m min(n-1,k) min n-1 n 1 k ans = 1 ans 1 dp0 = [1]*(m+1) dp0 [1]*(m+1) [1] 1 m+1 m 1 dp1 = [1]*(m+1) dp1 [1]*(m+1) [1] 1 m+1 m 1 for i in range(1,m+1):
        dp0[i] = dp0[i-1]*(n-i+1)*pow(i,mod-2,mod)%mod
        dp1[i] = dp1[i-1]*(n-i)*pow(i,mod-2,mod)%mod
        ans += dp0[i]*dp1[i]%mod
        ans %= mod
     i range(1,m+1) range 1 m+1 m 1 dp0[i] = dp0[i-1]*(n-i+1)*pow(i,mod-2,mod)%mod dp0[i] dp0 i dp0[i-1]*(n-i+1)*pow(i,mod-2,mod)%mod dp0[i-1]*(n-i+1)*pow(i,mod-2,mod) dp0[i-1]*(n-i+1) dp0[i-1] dp0 i-1 i 1 n-i+1 n-i n i 1 pow(i,mod-2,mod) pow i mod-2 mod 2 mod mod dp1[i] = dp1[i-1]*(n-i)*pow(i,mod-2,mod)%mod dp1[i] dp1 i dp1[i-1]*(n-i)*pow(i,mod-2,mod)%mod dp1[i-1]*(n-i)*pow(i,mod-2,mod) dp1[i-1]*(n-i) dp1[i-1] dp1 i-1 i 1 n-i n i pow(i,mod-2,mod) pow i mod-2 mod 2 mod mod ans += dp0[i]*dp1[i]%mod ans dp0[i]*dp1[i]%mod dp0[i]*dp1[i] dp0[i] dp0 i dp1[i] dp1 i mod ans %= mod ans mod return ans ans print(solve()) print solve() solve def solve():
    mod = 10**9+7
    n, k = map(int, input().split())
    m = min(n-1,k)
    ans = 1
    dp0 = [1]*(m+1)
    dp1 = [1]*(m+1)
    for i in range(1,m+1):
        dp0[i] = dp0[i-1]*(n-i+1)*pow(i,mod-2,mod)%mod
        dp1[i] = dp1[i-1]*(n-i)*pow(i,mod-2,mod)%mod
        ans += dp0[i]*dp1[i]%mod
        ans %= mod
    return ans def solve():
    mod = 10**9+7
    n, k = map(int, input().split())
    m = min(n-1,k)
    ans = 1
    dp0 = [1]*(m+1)
    dp1 = [1]*(m+1)
    for i in range(1,m+1):
        dp0[i] = dp0[i-1]*(n-i+1)*pow(i,mod-2,mod)%mod
        dp1[i] = dp1[i-1]*(n-i)*pow(i,mod-2,mod)%mod
        ans += dp0[i]*dp1[i]%mod
        ans %= mod
    return ans solve
def solve():
    mod = 10**9+7
    n, k = map(int, input().split())
    m = min(n-1,k)
    ans = 1
    dp0 = [1]*(m+1)
    dp1 = [1]*(m+1)
    for i in range(1,m+1):
        dp0[i] = dp0[i-1]*(n-i+1)*pow(i,mod-2,mod)%mod
        dp1[i] = dp1[i-1]*(n-i)*pow(i,mod-2,mod)%mod
        ans += dp0[i]*dp1[i]%mod
        ans %= mod
    return ans
print(solve())
