import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,copy,functools
import time,random

sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**10
mod = 10**9+7
mod2 = 998244353
dd = [(-1,0),(0,1),(1,0),(0,-1)]
ddn = [(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(): return [list(map(int, l.split())) for l in sys.stdin.readlines()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)
def pe(s): return print(str(s), file=sys.stderr)
def JA(a, sep): return sep.join(map(str, a))
def JAA(a, s, t): return s.join(t.join(map(str, b)) for b in a)

def M(n): return ModInt(n)
def MI(): return M(I())

class ModInt():
    def __init__(self, n):
        self.n = n

    def __add__(self, x):
        x = ModInt.xn(x)
        return ModInt((self.n+x) % mod)

    def __sub__(self, x):
        x = ModInt.xn(x)
        return ModInt((self.n-x) % mod)

    def __mul__(self, x):
        x = ModInt.xn(x)
        return ModInt((self.n*x) % mod)

    def __truediv__(self, x):
        x = ModInt.xn(x)
        return ModInt(self.n * pow(x, mod-2, mod) % mod)

    @classmethod
    def xn(cls, x):
        if isinstance(x, ModInt):
            return x.n
        return x

    def __str__(self):
        return str(self.n)

def inv(x):
    return pow(x, mod - 2, mod)

cms = 10**6
cm = [0] * cms

def comb_init():
    cm[0] = 1
    for i in range(1, cms):
        cm[i] = cm[i-1] * i % mod

def comb(a, b):
    return (cm[a] * inv(cm[a-b]) % mod) * inv(cm[b]) % mod

def h(a,b):
    return comb(a+b-1, b)

def main():
    n,k = LI()
    comb_init()
    r = M(1)
    t = M(1)
    for i in range(1, min(n-1,k)+1):
        t *= n-i+1
        t /= i
        r += t * h(n-i,i)

    return r


print(main())


 import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,copy,functools math string itertools fractions heapq collections re array bisect sys copy functools import time,random time random sys.setrecursionlimit(10**7) sys.setrecursionlimit sys setrecursionlimit 10**7 10 7 inf = 10**20 inf 10**20 10 20 eps = 1.0 / 10**10 eps 1.0 / 10**10 1.0 10**10 10 10 mod = 10**9+7 mod 10**9+7 10**9 10 9 7 mod2 = 998244353 mod2 998244353 dd = [(-1,0),(0,1),(1,0),(0,-1)] dd [(-1,0),(0,1),(1,0),(0,-1)] (-1,0) -1 0 (0,1) 0 1 (1,0) 1 0 (0,-1) 0 -1 ddn = [(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)] ddn [(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)] (-1,0) -1 0 (-1,1) -1 1 (0,1) 0 1 (1,1) 1 1 (1,0) 1 0 (1,-1) 1 -1 (0,-1) 0 -1 (-1,-1) -1 -1 def LI(): return list(map(int, sys.stdin.readline().split())) LI list(map(int, l.split())) for l in sys.stdin.readlines() for l in sys.stdin.readlines() l sys.stdin.readlines() sys.stdin.readlines sys.stdin sys stdin readlines for l in sys.stdin.readlines() list(map(int, l.split())) list map(int, l.split()) map int l.split() l.split l split def LLI(): return [list(map(int, l.split())) for l in sys.stdin.readlines()] LLI int(x)-1 for x in sys.stdin.readline().split() for x in sys.stdin.readline().split() x sys.stdin.readline().split() sys.stdin.readline().split sys.stdin.readline() sys.stdin.readline sys.stdin sys stdin readline split for x in sys.stdin.readline().split() int(x)-1 int(x) int x 1 def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()] LI_ float(x) for x in sys.stdin.readline().split() for x in sys.stdin.readline().split() x sys.stdin.readline().split() sys.stdin.readline().split sys.stdin.readline() sys.stdin.readline sys.stdin sys stdin readline split for x in sys.stdin.readline().split() float(x) float x def LF(): return [float(x) for x in sys.stdin.readline().split()] LF def LS(): return sys.stdin.readline().split() LS def I(): return int(sys.stdin.readline()) I def F(): return float(sys.stdin.readline()) F def S(): return input() S def pf(s): return print(s, flush=True) pf s s def pe(s): return print(str(s), file=sys.stderr) pe s s def JA(a, sep): return sep.join(map(str, a)) JA a a sep sep def JAA(a, s, t): return s.join(t.join(map(str, b)) for b in a) JAA a a s s t t def M(n): return ModInt(n) M n n def MI(): return M(I()) MI class ModInt():
    def __init__(self, n):
        self.n = n

    def __add__(self, x):
        x = ModInt.xn(x)
        return ModInt((self.n+x) % mod)

    def __sub__(self, x):
        x = ModInt.xn(x)
        return ModInt((self.n-x) % mod)

    def __mul__(self, x):
        x = ModInt.xn(x)
        return ModInt((self.n*x) % mod)

    def __truediv__(self, x):
        x = ModInt.xn(x)
        return ModInt(self.n * pow(x, mod-2, mod) % mod)

    @classmethod
    def xn(cls, x):
        if isinstance(x, ModInt):
            return x.n
        return x

    def __str__(self):
        return str(self.n) ModInt def __init__(self, n):
        self.n = n

     __init__ self.n = n self.n self n n self self n n def __add__(self, x):
        x = ModInt.xn(x)
        return ModInt((self.n+x) % mod)

     __add__ x = ModInt.xn(x) x ModInt.xn(x) ModInt.xn ModInt xn x return ModInt((self.n+x) % mod) ModInt((self.n+x) % mod) ModInt (self.n+x) % mod self.n+x self.n self n x mod self self x x def __sub__(self, x):
        x = ModInt.xn(x)
        return ModInt((self.n-x) % mod)

     __sub__ x = ModInt.xn(x) x ModInt.xn(x) ModInt.xn ModInt xn x return ModInt((self.n-x) % mod) ModInt((self.n-x) % mod) ModInt (self.n-x) % mod self.n-x self.n self n x mod self self x x def __mul__(self, x):
        x = ModInt.xn(x)
        return ModInt((self.n*x) % mod)

     __mul__ x = ModInt.xn(x) x ModInt.xn(x) ModInt.xn ModInt xn x return ModInt((self.n*x) % mod) ModInt((self.n*x) % mod) ModInt (self.n*x) % mod self.n*x self.n self n x mod self self x x def __truediv__(self, x):
        x = ModInt.xn(x)
        return ModInt(self.n * pow(x, mod-2, mod) % mod)

     __truediv__ x = ModInt.xn(x) x ModInt.xn(x) ModInt.xn ModInt xn x return ModInt(self.n * pow(x, mod-2, mod) % mod) ModInt(self.n * pow(x, mod-2, mod) % mod) ModInt self.n * pow(x, mod-2, mod) % mod self.n * pow(x, mod-2, mod) self.n self n pow(x, mod-2, mod) pow x mod-2 mod 2 mod mod self self x x def xn(cls, x):
        if isinstance(x, ModInt):
            return x.n
        return x

     xn if isinstance(x, ModInt):
            return x.n
         isinstance(x, ModInt) isinstance x ModInt return x.n x.n x n return x x cls cls x x @classmethod
     xn classmethod xn def __str__(self):
        return str(self.n) __str__ return str(self.n) str(self.n) str self.n self n self self def inv(x):
    return pow(x, mod - 2, mod) inv return pow(x, mod - 2, mod) pow(x, mod - 2, mod) pow x mod - 2 mod 2 mod x x cms = 10**6 cms 10**6 10 6 cm = [0] * cms cm [0] * cms [0] 0 cms def comb_init():
    cm[0] = 1
    for i in range(1, cms):
        cm[i] = cm[i-1] * i % mod comb_init cm[0] = 1 cm[0] cm 0 1 for i in range(1, cms):
        cm[i] = cm[i-1] * i % mod i range(1, cms) range 1 cms cm[i] = cm[i-1] * i % mod cm[i] cm i cm[i-1] * i % mod cm[i-1] * i cm[i-1] cm i-1 i 1 i mod def comb(a, b):
    return (cm[a] * inv(cm[a-b]) % mod) * inv(cm[b]) % mod comb return (cm[a] * inv(cm[a-b]) % mod) * inv(cm[b]) % mod (cm[a] * inv(cm[a-b]) % mod) * inv(cm[b]) % mod (cm[a] * inv(cm[a-b]) % mod) * inv(cm[b]) cm[a] * inv(cm[a-b]) % mod cm[a] * inv(cm[a-b]) cm[a] cm a inv(cm[a-b]) inv cm[a-b] cm a-b a b mod inv(cm[b]) inv cm[b] cm b mod a a b b def h(a,b):
    return comb(a+b-1, b) h return comb(a+b-1, b) comb(a+b-1, b) comb a+b-1 a+b a b 1 b a a b b def main():
    n,k = LI()
    comb_init()
    r = M(1)
    t = M(1)
    for i in range(1, min(n-1,k)+1):
        t *= n-i+1
        t /= i
        r += t * h(n-i,i)

    return r main n,k = LI() n LI() LI k comb_init() comb_init r = M(1) r M(1) M 1 t = M(1) t M(1) M 1 for i in range(1, min(n-1,k)+1):
        t *= n-i+1
        t /= i
        r += t * h(n-i,i)

     i range(1, min(n-1,k)+1) range 1 min(n-1,k)+1 min(n-1,k) min n-1 n 1 k 1 t *= n-i+1 t n-i+1 n-i n i 1 t /= i t i r += t * h(n-i,i) r t * h(n-i,i) t h(n-i,i) h n-i n i i return r r print(main()) print main() main def h(a,b):
    return comb(a+b-1, b) def h(a,b):
    return comb(a+b-1, b) h mod2 = 998244353 998244353 mod2 def main():
    n,k = LI()
    comb_init()
    r = M(1)
    t = M(1)
    for i in range(1, min(n-1,k)+1):
        t *= n-i+1
        t /= i
        r += t * h(n-i,i)

    return r def main():
    n,k = LI()
    comb_init()
    r = M(1)
    t = M(1)
    for i in range(1, min(n-1,k)+1):
        t *= n-i+1
        t /= i
        r += t * h(n-i,i)

    return r main def LI(): return list(map(int, sys.stdin.readline().split())) def LI(): return list(map(int, sys.stdin.readline().split())) LI def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()] def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()] LI_ def LS(): return sys.stdin.readline().split() def LS(): return sys.stdin.readline().split() LS def inv(x):
    return pow(x, mod - 2, mod) def inv(x):
    return pow(x, mod - 2, mod) inv def LLI(): return [list(map(int, l.split())) for l in sys.stdin.readlines()] def LLI(): return [list(map(int, l.split())) for l in sys.stdin.readlines()] LLI def pe(s): return print(str(s), file=sys.stderr) def pe(s): return print(str(s), file=sys.stderr) pe def JAA(a, s, t): return s.join(t.join(map(str, b)) for b in a) def JAA(a, s, t): return s.join(t.join(map(str, b)) for b in a) JAA def pf(s): return print(s, flush=True) def pf(s): return print(s, flush=True) pf class ModInt():
    def __init__(self, n):
        self.n = n

    def __add__(self, x):
        x = ModInt.xn(x)
        return ModInt((self.n+x) % mod)

    def __sub__(self, x):
        x = ModInt.xn(x)
        return ModInt((self.n-x) % mod)

    def __mul__(self, x):
        x = ModInt.xn(x)
        return ModInt((self.n*x) % mod)

    def __truediv__(self, x):
        x = ModInt.xn(x)
        return ModInt(self.n * pow(x, mod-2, mod) % mod)

    @classmethod
    def xn(cls, x):
        if isinstance(x, ModInt):
            return x.n
        return x

    def __str__(self):
        return str(self.n) class ModInt():
    def __init__(self, n):
        self.n = n

    def __add__(self, x):
        x = ModInt.xn(x)
        return ModInt((self.n+x) % mod)

    def __sub__(self, x):
        x = ModInt.xn(x)
        return ModInt((self.n-x) % mod)

    def __mul__(self, x):
        x = ModInt.xn(x)
        return ModInt((self.n*x) % mod)

    def __truediv__(self, x):
        x = ModInt.xn(x)
        return ModInt(self.n * pow(x, mod-2, mod) % mod)

    @classmethod
    def xn(cls, x):
        if isinstance(x, ModInt):
            return x.n
        return x

    def __str__(self):
        return str(self.n) ModInt mod = 10**9+7 10**9+7 mod def JA(a, sep): return sep.join(map(str, a)) def JA(a, sep): return sep.join(map(str, a)) JA inf = 10**20 10**20 inf cms = 10**6 10**6 cms def comb_init():
    cm[0] = 1
    for i in range(1, cms):
        cm[i] = cm[i-1] * i % mod def comb_init():
    cm[0] = 1
    for i in range(1, cms):
        cm[i] = cm[i-1] * i % mod comb_init def I(): return int(sys.stdin.readline()) def I(): return int(sys.stdin.readline()) I eps = 1.0 / 10**10 1.0 / 10**10 eps def F(): return float(sys.stdin.readline()) def F(): return float(sys.stdin.readline()) F def comb(a, b):
    return (cm[a] * inv(cm[a-b]) % mod) * inv(cm[b]) % mod def comb(a, b):
    return (cm[a] * inv(cm[a-b]) % mod) * inv(cm[b]) % mod comb dd = [(-1,0),(0,1),(1,0),(0,-1)] [(-1,0),(0,1),(1,0),(0,-1)] dd def M(n): return ModInt(n) def M(n): return ModInt(n) M def S(): return input() def S(): return input() S cm = [0] * cms [0] * cms cm ddn = [(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)] [(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)] ddn def MI(): return M(I()) def MI(): return M(I()) MI def LF(): return [float(x) for x in sys.stdin.readline().split()] def LF(): return [float(x) for x in sys.stdin.readline().split()] LF
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,copy,functools
import time,random

sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**10
mod = 10**9+7
mod2 = 998244353
dd = [(-1,0),(0,1),(1,0),(0,-1)]
ddn = [(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(): return [list(map(int, l.split())) for l in sys.stdin.readlines()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)
def pe(s): return print(str(s), file=sys.stderr)
def JA(a, sep): return sep.join(map(str, a))
def JAA(a, s, t): return s.join(t.join(map(str, b)) for b in a)

def M(n): return ModInt(n)
def MI(): return M(I())

class ModInt():
    def __init__(self, n):
        self.n = n

    def __add__(self, x):
        x = ModInt.xn(x)
        return ModInt((self.n+x) % mod)

    def __sub__(self, x):
        x = ModInt.xn(x)
        return ModInt((self.n-x) % mod)

    def __mul__(self, x):
        x = ModInt.xn(x)
        return ModInt((self.n*x) % mod)

    def __truediv__(self, x):
        x = ModInt.xn(x)
        return ModInt(self.n * pow(x, mod-2, mod) % mod)

    @classmethod
    def xn(cls, x):
        if isinstance(x, ModInt):
            return x.n
        return x

    def __str__(self):
        return str(self.n)

def inv(x):
    return pow(x, mod - 2, mod)

cms = 10**6
cm = [0] * cms

def comb_init():
    cm[0] = 1
    for i in range(1, cms):
        cm[i] = cm[i-1] * i % mod

def comb(a, b):
    return (cm[a] * inv(cm[a-b]) % mod) * inv(cm[b]) % mod

def h(a,b):
    return comb(a+b-1, b)

def main():
    n,k = LI()
    comb_init()
    r = M(1)
    t = M(1)
    for i in range(1, min(n-1,k)+1):
        t *= n-i+1
        t /= i
        r += t * h(n-i,i)

    return r


print(main())



