import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines

MOD = 10**9+7

fac = [1, 1]
f_inv = [1, 1]
inv = [0, 1]

def prepare(n, mod):
    for i in range(2, n+1):
        fac.append((fac[-1] * i) % mod)
        inv.append((-inv[mod % i] * (mod//i)) % mod)
        f_inv.append((f_inv[-1] * inv[-1]) % mod)


def modcmb(n, r, mod):
    if n < 0 or r < 0 or r > n:
        return 0

    return fac[n] * f_inv[r] * f_inv[n-r] % mod


def main():
    N,K = map(int, readline().split())

    prepare(N, MOD)

    ans = 0
    for i in range(min(N-1, K)+1):
        ans += modcmb(N, i, MOD) * modcmb(N-1, i, MOD)
        ans %= MOD

    print(ans)


if __name__ == "__main__":
    main() import sys sys read = sys.stdin.read read sys.stdin.read sys.stdin sys stdin read readline = sys.stdin.readline readline sys.stdin.readline sys.stdin sys stdin readline readlines = sys.stdin.readlines readlines sys.stdin.readlines sys.stdin sys stdin readlines MOD = 10**9+7 MOD 10**9+7 10**9 10 9 7 fac = [1, 1] fac [1, 1] 1 1 f_inv = [1, 1] f_inv [1, 1] 1 1 inv = [0, 1] inv [0, 1] 0 1 def prepare(n, mod):
    for i in range(2, n+1):
        fac.append((fac[-1] * i) % mod)
        inv.append((-inv[mod % i] * (mod//i)) % mod)
        f_inv.append((f_inv[-1] * inv[-1]) % mod) prepare for i in range(2, n+1):
        fac.append((fac[-1] * i) % mod)
        inv.append((-inv[mod % i] * (mod//i)) % mod)
        f_inv.append((f_inv[-1] * inv[-1]) % mod) i range(2, n+1) range 2 n+1 n 1 fac.append((fac[-1] * i) % mod) fac.append fac append (fac[-1] * i) % mod fac[-1] * i fac[-1] fac -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 f_inv.append((f_inv[-1] * inv[-1]) % mod) f_inv.append f_inv append (f_inv[-1] * inv[-1]) % mod f_inv[-1] * inv[-1] f_inv[-1] f_inv -1 inv[-1] inv -1 mod n n mod mod def modcmb(n, r, mod):
    if n < 0 or r < 0 or r > n:
        return 0

    return fac[n] * f_inv[r] * f_inv[n-r] % mod modcmb if n < 0 or r < 0 or r > n:
        return 0

     n < 0 or r < 0 or r > n n < 0 or r < 0 n < 0 n 0 r < 0 r 0 r > n r n return 0 0 return fac[n] * f_inv[r] * f_inv[n-r] % mod fac[n] * f_inv[r] * f_inv[n-r] % mod fac[n] * f_inv[r] * f_inv[n-r] fac[n] * f_inv[r] fac[n] fac n f_inv[r] f_inv r f_inv[n-r] f_inv n-r n r mod n n r r mod mod def main():
    N,K = map(int, readline().split())

    prepare(N, MOD)

    ans = 0
    for i in range(min(N-1, K)+1):
        ans += modcmb(N, i, MOD) * modcmb(N-1, i, MOD)
        ans %= MOD

    print(ans) main N,K = map(int, readline().split()) N map(int, readline().split()) map int readline().split() ().split () readline split K prepare(N, MOD) prepare N MOD ans = 0 ans 0 for i in range(min(N-1, K)+1):
        ans += modcmb(N, i, MOD) * modcmb(N-1, i, MOD)
        ans %= MOD

     i range(min(N-1, K)+1) range min(N-1, K)+1 min(N-1, K) min N-1 N 1 K 1 ans += modcmb(N, i, MOD) * modcmb(N-1, i, MOD) ans modcmb(N, i, MOD) * modcmb(N-1, i, MOD) modcmb(N, i, MOD) modcmb N i MOD modcmb(N-1, i, MOD) modcmb N-1 N 1 i MOD ans %= MOD ans MOD print(ans) print ans if __name__ == "__main__":
    main() __name__ == "__main__" __name__ "__main__" main() main def main():
    N,K = map(int, readline().split())

    prepare(N, MOD)

    ans = 0
    for i in range(min(N-1, K)+1):
        ans += modcmb(N, i, MOD) * modcmb(N-1, i, MOD)
        ans %= MOD

    print(ans) def main():
    N,K = map(int, readline().split())

    prepare(N, MOD)

    ans = 0
    for i in range(min(N-1, K)+1):
        ans += modcmb(N, i, MOD) * modcmb(N-1, i, MOD)
        ans %= MOD

    print(ans) main readline = sys.stdin.readline sys.stdin.readline readline f_inv = [1, 1] [1, 1] f_inv def modcmb(n, r, mod):
    if n < 0 or r < 0 or r > n:
        return 0

    return fac[n] * f_inv[r] * f_inv[n-r] % mod def modcmb(n, r, mod):
    if n < 0 or r < 0 or r > n:
        return 0

    return fac[n] * f_inv[r] * f_inv[n-r] % mod modcmb def prepare(n, mod):
    for i in range(2, n+1):
        fac.append((fac[-1] * i) % mod)
        inv.append((-inv[mod % i] * (mod//i)) % mod)
        f_inv.append((f_inv[-1] * inv[-1]) % mod) def prepare(n, mod):
    for i in range(2, n+1):
        fac.append((fac[-1] * i) % mod)
        inv.append((-inv[mod % i] * (mod//i)) % mod)
        f_inv.append((f_inv[-1] * inv[-1]) % mod) prepare inv = [0, 1] [0, 1] inv read = sys.stdin.read sys.stdin.read read MOD = 10**9+7 10**9+7 MOD readlines = sys.stdin.readlines sys.stdin.readlines readlines fac = [1, 1] [1, 1] fac
import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines

MOD = 10**9+7

fac = [1, 1]
f_inv = [1, 1]
inv = [0, 1]

def prepare(n, mod):
    for i in range(2, n+1):
        fac.append((fac[-1] * i) % mod)
        inv.append((-inv[mod % i] * (mod//i)) % mod)
        f_inv.append((f_inv[-1] * inv[-1]) % mod)


def modcmb(n, r, mod):
    if n < 0 or r < 0 or r > n:
        return 0

    return fac[n] * f_inv[r] * f_inv[n-r] % mod


def main():
    N,K = map(int, readline().split())

    prepare(N, MOD)

    ans = 0
    for i in range(min(N-1, K)+1):
        ans += modcmb(N, i, MOD) * modcmb(N-1, i, MOD)
        ans %= MOD

    print(ans)


if __name__ == "__main__":
    main()
