import sys

n, k = map(int, input().split())
P = int(1e9+7)


def cmb(n, r, P):
    r = min(r, n - r)
    inv_y = 1
    for i in range(1, r + 1):
        inv_y = (inv_y * i) % P
    inv_y = pow(inv_y, P - 2, P)
    x = 1
    for i in range(n - r + 1, n + 1):
        x = x * i % P
    return (x * inv_y) % P


if k >= n:
    print(cmb(2*n-1, n, P))
    sys.exit()
if k == 1:
    print((n * n - 1) % P)
    sys.exit()
ans = 1
comb1 = 1
comb2 = 1
for i in range(1, k + 1):
    iinv = pow(i, P-2, P)
    comb1 = ((comb1 * (n - i)) * (iinv)) % P
    comb2 = ((comb2 * (n - i + 1)) * (iinv)) % P
    ans = (ans + comb1*comb2) % P
print(ans) import sys sys n, k = map(int, input().split()) n map(int, input().split()) map int input().split() ().split () input split k P = int(1e9+7) P int(1e9+7) int 1e9+7 1e9 7 def cmb(n, r, P):
    r = min(r, n - r)
    inv_y = 1
    for i in range(1, r + 1):
        inv_y = (inv_y * i) % P
    inv_y = pow(inv_y, P - 2, P)
    x = 1
    for i in range(n - r + 1, n + 1):
        x = x * i % P
    return (x * inv_y) % P cmb r = min(r, n - r) r min(r, n - r) min r n - r n r inv_y = 1 inv_y 1 for i in range(1, r + 1):
        inv_y = (inv_y * i) % P
     i range(1, r + 1) range 1 r + 1 r 1 inv_y = (inv_y * i) % P inv_y (inv_y * i) % P inv_y * i inv_y i P inv_y = pow(inv_y, P - 2, P) inv_y pow(inv_y, P - 2, P) pow inv_y P - 2 P 2 P x = 1 x 1 for i in range(n - r + 1, n + 1):
        x = x * i % P
     i range(n - r + 1, n + 1) range n - r + 1 n - r n r 1 n + 1 n 1 x = x * i % P x x * i % P x * i x i P return (x * inv_y) % P (x * inv_y) % P x * inv_y x inv_y P n n r r P P if k >= n:
    print(cmb(2*n-1, n, P))
    sys.exit() k >= n k n print(cmb(2*n-1, n, P)) print cmb(2*n-1, n, P) cmb 2*n-1 2*n 2 n 1 n P sys.exit() sys.exit sys exit if k == 1:
    print((n * n - 1) % P)
    sys.exit() k == 1 k 1 print((n * n - 1) % P) print (n * n - 1) % P n * n - 1 n * n n n 1 P sys.exit() sys.exit sys exit ans = 1 ans 1 comb1 = 1 comb1 1 comb2 = 1 comb2 1 for i in range(1, k + 1):
    iinv = pow(i, P-2, P)
    comb1 = ((comb1 * (n - i)) * (iinv)) % P
    comb2 = ((comb2 * (n - i + 1)) * (iinv)) % P
    ans = (ans + comb1*comb2) % P i range(1, k + 1) range 1 k + 1 k 1 iinv = pow(i, P-2, P) iinv pow(i, P-2, P) pow i P-2 P 2 P comb1 = ((comb1 * (n - i)) * (iinv)) % P comb1 ((comb1 * (n - i)) * (iinv)) % P (comb1 * (n - i)) * (iinv) comb1 * (n - i) comb1 n - i n i iinv P comb2 = ((comb2 * (n - i + 1)) * (iinv)) % P comb2 ((comb2 * (n - i + 1)) * (iinv)) % P (comb2 * (n - i + 1)) * (iinv) comb2 * (n - i + 1) comb2 n - i + 1 n - i n i 1 iinv P ans = (ans + comb1*comb2) % P ans (ans + comb1*comb2) % P ans + comb1*comb2 ans comb1*comb2 comb1 comb2 P print(ans) print ans iinv = pow(i, P-2, P) pow(i, P-2, P) iinv comb1 = ((comb1 * (n - i)) * (iinv)) % P ((comb1 * (n - i)) * (iinv)) % P comb1 comb2 = ((comb2 * (n - i + 1)) * (iinv)) % P ((comb2 * (n - i + 1)) * (iinv)) % P comb2 n, k = map(int, input().split()) map(int, input().split()) n def cmb(n, r, P):
    r = min(r, n - r)
    inv_y = 1
    for i in range(1, r + 1):
        inv_y = (inv_y * i) % P
    inv_y = pow(inv_y, P - 2, P)
    x = 1
    for i in range(n - r + 1, n + 1):
        x = x * i % P
    return (x * inv_y) % P def cmb(n, r, P):
    r = min(r, n - r)
    inv_y = 1
    for i in range(1, r + 1):
        inv_y = (inv_y * i) % P
    inv_y = pow(inv_y, P - 2, P)
    x = 1
    for i in range(n - r + 1, n + 1):
        x = x * i % P
    return (x * inv_y) % P cmb ans = 1 1 ans k = map(int, input().split()) map(int, input().split()) k comb2 = 1 1 comb2 comb1 = 1 1 comb1 ans = (ans + comb1*comb2) % P (ans + comb1*comb2) % P ans P = int(1e9+7) int(1e9+7) P
import sys

n, k = map(int, input().split())
P = int(1e9+7)


def cmb(n, r, P):
    r = min(r, n - r)
    inv_y = 1
    for i in range(1, r + 1):
        inv_y = (inv_y * i) % P
    inv_y = pow(inv_y, P - 2, P)
    x = 1
    for i in range(n - r + 1, n + 1):
        x = x * i % P
    return (x * inv_y) % P


if k >= n:
    print(cmb(2*n-1, n, P))
    sys.exit()
if k == 1:
    print((n * n - 1) % P)
    sys.exit()
ans = 1
comb1 = 1
comb2 = 1
for i in range(1, k + 1):
    iinv = pow(i, P-2, P)
    comb1 = ((comb1 * (n - i)) * (iinv)) % P
    comb2 = ((comb2 * (n - i + 1)) * (iinv)) % P
    ans = (ans + comb1*comb2) % P
print(ans)
