MOD = 10**9+7


def make_cmb_table(n):
    fact = [1]
    for i in range(1, n+1):
        fact.append(fact[i-1] * i % MOD)

    ifact = [0] * (n+1)
    ifact[n] = pow(fact[n], MOD-2, MOD)
    for i in range(n, 0, -1):
        ifact[i-1] = ifact[i] * i % MOD
    return (fact, ifact)


def cmb(n, r, table):
    if r > n:
        return 0
    return table[0][n] * table[1][n - r] * table[1][r] % MOD


def main():
    n, k = map(int, input().split())
    k = min(k, n-1)
    table = make_cmb_table(n)
    ans = 0
    for i in range(k+1):
        ans += cmb(n, i, table) * cmb((n-i-1)+i, i, table) % MOD
        ans %= MOD
    print(ans)


main() MOD = 10**9+7 MOD 10**9+7 10**9 10 9 7 def make_cmb_table(n):
    fact = [1]
    for i in range(1, n+1):
        fact.append(fact[i-1] * i % MOD)

    ifact = [0] * (n+1)
    ifact[n] = pow(fact[n], MOD-2, MOD)
    for i in range(n, 0, -1):
        ifact[i-1] = ifact[i] * i % MOD
    return (fact, ifact) make_cmb_table fact = [1] fact [1] 1 for i in range(1, n+1):
        fact.append(fact[i-1] * i % MOD)

     i range(1, n+1) range 1 n+1 n 1 fact.append(fact[i-1] * i % MOD) fact.append fact append fact[i-1] * i % MOD fact[i-1] * i fact[i-1] fact i-1 i 1 i MOD ifact = [0] * (n+1) ifact [0] * (n+1) [0] 0 n+1 n 1 ifact[n] = pow(fact[n], MOD-2, MOD) ifact[n] ifact n pow(fact[n], MOD-2, MOD) pow fact[n] fact n MOD-2 MOD 2 MOD for i in range(n, 0, -1):
        ifact[i-1] = ifact[i] * i % MOD
     i range(n, 0, -1) range n 0 -1 ifact[i-1] = ifact[i] * i % MOD ifact[i-1] ifact i-1 i 1 ifact[i] * i % MOD ifact[i] * i ifact[i] ifact i i MOD return (fact, ifact) (fact, ifact) fact ifact n n def cmb(n, r, table):
    if r > n:
        return 0
    return table[0][n] * table[1][n - r] * table[1][r] % MOD cmb if r > n:
        return 0
     r > n r n return 0 0 return table[0][n] * table[1][n - r] * table[1][r] % MOD table[0][n] * table[1][n - r] * table[1][r] % MOD table[0][n] * table[1][n - r] * table[1][r] table[0][n] * table[1][n - r] table[0][n] [0] table 0 n table[1][n - r] [1] table 1 n - r n r table[1][r] [1] table 1 r MOD n n r r table table def main():
    n, k = map(int, input().split())
    k = min(k, n-1)
    table = make_cmb_table(n)
    ans = 0
    for i in range(k+1):
        ans += cmb(n, i, table) * cmb((n-i-1)+i, i, table) % MOD
        ans %= MOD
    print(ans) main n, k = map(int, input().split()) n map(int, input().split()) map int input().split() ().split () input split k k = min(k, n-1) k min(k, n-1) min k n-1 n 1 table = make_cmb_table(n) table make_cmb_table(n) make_cmb_table n ans = 0 ans 0 for i in range(k+1):
        ans += cmb(n, i, table) * cmb((n-i-1)+i, i, table) % MOD
        ans %= MOD
     i range(k+1) range k+1 k 1 ans += cmb(n, i, table) * cmb((n-i-1)+i, i, table) % MOD ans cmb(n, i, table) * cmb((n-i-1)+i, i, table) % MOD cmb(n, i, table) * cmb((n-i-1)+i, i, table) cmb(n, i, table) cmb n i table cmb((n-i-1)+i, i, table) cmb (n-i-1)+i n-i-1 n-i n i 1 i i table MOD ans %= MOD ans MOD print(ans) print ans main() main def main():
    n, k = map(int, input().split())
    k = min(k, n-1)
    table = make_cmb_table(n)
    ans = 0
    for i in range(k+1):
        ans += cmb(n, i, table) * cmb((n-i-1)+i, i, table) % MOD
        ans %= MOD
    print(ans) def main():
    n, k = map(int, input().split())
    k = min(k, n-1)
    table = make_cmb_table(n)
    ans = 0
    for i in range(k+1):
        ans += cmb(n, i, table) * cmb((n-i-1)+i, i, table) % MOD
        ans %= MOD
    print(ans) main def make_cmb_table(n):
    fact = [1]
    for i in range(1, n+1):
        fact.append(fact[i-1] * i % MOD)

    ifact = [0] * (n+1)
    ifact[n] = pow(fact[n], MOD-2, MOD)
    for i in range(n, 0, -1):
        ifact[i-1] = ifact[i] * i % MOD
    return (fact, ifact) def make_cmb_table(n):
    fact = [1]
    for i in range(1, n+1):
        fact.append(fact[i-1] * i % MOD)

    ifact = [0] * (n+1)
    ifact[n] = pow(fact[n], MOD-2, MOD)
    for i in range(n, 0, -1):
        ifact[i-1] = ifact[i] * i % MOD
    return (fact, ifact) make_cmb_table def cmb(n, r, table):
    if r > n:
        return 0
    return table[0][n] * table[1][n - r] * table[1][r] % MOD def cmb(n, r, table):
    if r > n:
        return 0
    return table[0][n] * table[1][n - r] * table[1][r] % MOD cmb MOD = 10**9+7 10**9+7 MOD
MOD = 10**9+7


def make_cmb_table(n):
    fact = [1]
    for i in range(1, n+1):
        fact.append(fact[i-1] * i % MOD)

    ifact = [0] * (n+1)
    ifact[n] = pow(fact[n], MOD-2, MOD)
    for i in range(n, 0, -1):
        ifact[i-1] = ifact[i] * i % MOD
    return (fact, ifact)


def cmb(n, r, table):
    if r > n:
        return 0
    return table[0][n] * table[1][n - r] * table[1][r] % MOD


def main():
    n, k = map(int, input().split())
    k = min(k, n-1)
    table = make_cmb_table(n)
    ans = 0
    for i in range(k+1):
        ans += cmb(n, i, table) * cmb((n-i-1)+i, i, table) % MOD
        ans %= MOD
    print(ans)


main()
