import sys
sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
SIZE=4*10**5+1; MOD=10**9+7 #998244353 #ここを変更する
 
SIZE += 1
inv = [0]*SIZE  # inv[j] = j^{-1} mod MOD
fac = [0]*SIZE  # fac[j] = j! mod MOD
finv = [0]*SIZE # finv[j] = (j!)^{-1} mod MOD
inv[1] = 1
fac[0] = fac[1] = 1
finv[0] = finv[1] = 1
for i in range(2,SIZE):
    inv[i] = MOD - (MOD//i)*inv[MOD%i]%MOD
    fac[i] = fac[i-1]*i%MOD
    finv[i]= finv[i-1]*inv[i]%MOD
 
def choose(n,r): # nCk mod MOD の計算
    if 0 <= r <= n:
        return (fac[n]*finv[r]%MOD)*finv[n-r]%MOD
    else:
        return 0
def resolve():
    n, k = lr()
    ans = choose(2*n-1, n)
    if n-1 > k:
        for i in range(1, n-k):
            ans -= choose(n, i)*choose(n-1, n-i)
            ans %= MOD
    print(ans)
resolve() import sys sys sr = lambda: sys.stdin.readline().rstrip() sr lambda: sys.stdin.readline().rstrip() sys.stdin.readline().rstrip() sys.stdin.readline().rstrip sys.stdin.readline() sys.stdin.readline sys.stdin sys stdin readline rstrip ir = lambda: int(sr()) ir lambda: int(sr()) int(sr()) int sr() sr lr = lambda: list(map(int, sr().split())) lr lambda: list(map(int, sr().split())) list(map(int, sr().split())) list map(int, sr().split()) map int sr().split() ().split () sr split SIZE=4*10**5+1 SIZE 4*10**5+1 4*10**5 4 10**5 10 5 1 MOD=10**9+7 MOD 10**9+7 10**9 10 9 7 SIZE += 1 SIZE 1 inv = [0]*SIZE inv [0]*SIZE [0] 0 SIZE fac = [0]*SIZE fac [0]*SIZE [0] 0 SIZE finv = [0]*SIZE finv [0]*SIZE [0] 0 SIZE inv[1] = 1 inv[1] inv 1 1 fac[0] = fac[1] = 1 fac[0] fac 0 1 = fac[1] = 1 fac[1] fac 1 1 finv[0] = finv[1] = 1 finv[0] finv 0 1 = finv[1] = 1 finv[1] finv 1 1 for i in range(2,SIZE):
    inv[i] = MOD - (MOD//i)*inv[MOD%i]%MOD
    fac[i] = fac[i-1]*i%MOD
    finv[i]= finv[i-1]*inv[i]%MOD
  i range(2,SIZE) range 2 SIZE inv[i] = MOD - (MOD//i)*inv[MOD%i]%MOD inv[i] inv i MOD - (MOD//i)*inv[MOD%i]%MOD MOD (MOD//i)*inv[MOD%i]%MOD (MOD//i)*inv[MOD%i] MOD//i MOD i inv[MOD%i] inv MOD%i MOD i MOD fac[i] = fac[i-1]*i%MOD fac[i] fac i fac[i-1]*i%MOD fac[i-1]*i fac[i-1] fac i-1 i 1 i MOD finv[i]= finv[i-1]*inv[i]%MOD finv[i] finv i finv[i-1]*inv[i]%MOD finv[i-1]*inv[i] finv[i-1] finv i-1 i 1 inv[i] inv i MOD def choose(n,r): # nCk mod MOD の計算
    if 0 <= r <= n:
        return (fac[n]*finv[r]%MOD)*finv[n-r]%MOD
    else:
        return 0 choose if 0 <= r <= n:
        return (fac[n]*finv[r]%MOD)*finv[n-r]%MOD
    else:
        return 0 0 <= r <= n 0 <= r 0 r n return (fac[n]*finv[r]%MOD)*finv[n-r]%MOD (fac[n]*finv[r]%MOD)*finv[n-r]%MOD (fac[n]*finv[r]%MOD)*finv[n-r] fac[n]*finv[r]%MOD fac[n]*finv[r] fac[n] fac n finv[r] finv r MOD finv[n-r] finv n-r n r MOD return 0 0 n n r r def resolve():
    n, k = lr()
    ans = choose(2*n-1, n)
    if n-1 > k:
        for i in range(1, n-k):
            ans -= choose(n, i)*choose(n-1, n-i)
            ans %= MOD
    print(ans) resolve n, k = lr() n lr() lr k ans = choose(2*n-1, n) ans choose(2*n-1, n) choose 2*n-1 2*n 2 n 1 n if n-1 > k:
        for i in range(1, n-k):
            ans -= choose(n, i)*choose(n-1, n-i)
            ans %= MOD
     n-1 > k n-1 n 1 k for i in range(1, n-k):
            ans -= choose(n, i)*choose(n-1, n-i)
            ans %= MOD
     i range(1, n-k) range 1 n-k n k ans -= choose(n, i)*choose(n-1, n-i) ans choose(n, i)*choose(n-1, n-i) choose(n, i) choose n i choose(n-1, n-i) choose n-1 n 1 n-i n i ans %= MOD ans MOD print(ans) print ans resolve() resolve SIZE += 1 1 SIZE ir = lambda: int(sr()) lambda: int(sr()) ir fac = [0]*SIZE [0]*SIZE fac inv = [0]*SIZE [0]*SIZE inv sr = lambda: sys.stdin.readline().rstrip() lambda: sys.stdin.readline().rstrip() sr lr = lambda: list(map(int, sr().split())) lambda: list(map(int, sr().split())) lr finv = [0]*SIZE [0]*SIZE finv def resolve():
    n, k = lr()
    ans = choose(2*n-1, n)
    if n-1 > k:
        for i in range(1, n-k):
            ans -= choose(n, i)*choose(n-1, n-i)
            ans %= MOD
    print(ans) def resolve():
    n, k = lr()
    ans = choose(2*n-1, n)
    if n-1 > k:
        for i in range(1, n-k):
            ans -= choose(n, i)*choose(n-1, n-i)
            ans %= MOD
    print(ans) resolve SIZE=4*10**5+1 4*10**5+1 SIZE MOD=10**9+7 10**9+7 MOD def choose(n,r): # nCk mod MOD の計算
    if 0 <= r <= n:
        return (fac[n]*finv[r]%MOD)*finv[n-r]%MOD
    else:
        return 0 def choose(n,r): # nCk mod MOD の計算
    if 0 <= r <= n:
        return (fac[n]*finv[r]%MOD)*finv[n-r]%MOD
    else:
        return 0 choose
import sys
sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
SIZE=4*10**5+1; MOD=10**9+7 #998244353 #ここを変更する
 
SIZE += 1
inv = [0]*SIZE  # inv[j] = j^{-1} mod MOD
fac = [0]*SIZE  # fac[j] = j! mod MOD
finv = [0]*SIZE # finv[j] = (j!)^{-1} mod MOD
inv[1] = 1
fac[0] = fac[1] = 1
finv[0] = finv[1] = 1
for i in range(2,SIZE):
    inv[i] = MOD - (MOD//i)*inv[MOD%i]%MOD
    fac[i] = fac[i-1]*i%MOD
    finv[i]= finv[i-1]*inv[i]%MOD
 
def choose(n,r): # nCk mod MOD の計算
    if 0 <= r <= n:
        return (fac[n]*finv[r]%MOD)*finv[n-r]%MOD
    else:
        return 0
def resolve():
    n, k = lr()
    ans = choose(2*n-1, n)
    if n-1 > k:
        for i in range(1, n-k):
            ans -= choose(n, i)*choose(n-1, n-i)
            ans %= MOD
    print(ans)
resolve()