def s_in():
    return input()

def n_in():
    return int(input())

def l_in():
    return list(map(int, input().split()))

class Interval():
    def __init__(self, li):
        self.li = li
        self.n = len(li)
        self.sum_li = [li[0]]
        for i in range(1, self.n):
            self.sum_li.append(self.sum_li[i-1] + li[i])

    def sum(self, a, b=None):
        if b is None:
            return self.sum(0, a)

        res = self.sum_li[min(self.n-1, b-1)]
        if a > 0:
            res -= self.sum_li[a-1]
        return res

def s_in():
    return input()

def n_in():
    return int(input())

def l_in():
    return list(map(int, input().split()))

class Interval():
    def __init__(self, li):
        self.li = li
        self.n = len(li)
        self.sum_li = [li[0]]
        for i in range(1, self.n):
            self.sum_li.append(self.sum_li[i-1] + li[i])

    def sum(self, a, b=None):
        if b is None:
            return self.sum(0, a)

        res = self.sum_li[min(self.n-1, b-1)]
        if a > 0:
            res -= self.sum_li[a-1]
        return res

MOD = 1000000007

def mod_add(a, b):
  return (a+b)%MOD

def mod_sub(a, b):
  return (a+MOD-b)%MOD

def mod_mul(a, b):
  return a*b%MOD

#互いに素なa,bについて、a*x+b*y=1の一つの解
def extgcd(a,b):
    r = (1,0,a)
    w = (0,1,b)
    while w[2]!=1:
        q = r[2]//w[2]
        r2 = w
        w2 = [r[0]-q*w[0],r[1]-q*w[1],r[2]-q*w[2]]
        r = r2
        w = w2
    return (w[0],w[1])

def mod_inv(a):
    x,_ = extgcd(a, MOD)
    return (MOD+x%MOD)%MOD

def mod_div(a, b):
    return a*mod_inv(b)%MOD

def mod_pow(a, b):
    res = 1
    while b > 0:
        if b & 1:
            res = res * a % MOD
        a = a * a % MOD
        b >>= 1
    return res


MAX = 400001

fac  = [0 for _ in range(MAX)]
finv = [0 for _ in range(MAX)]
inv  = [0 for _ in range(MAX)]

def COMinit():
    fac[0] = fac[1] = 1
    finv[0] = finv[1] = 1
    inv[1] = 1
    for i in range(2, MAX):
        fac[i] = fac[i - 1] * i % MOD
        inv[i] = MOD - inv[MOD%i] * (MOD // i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;

def mod_COM(n, k):
    if n < k:
        return 0
    if n < 0 or k < 0:
        return 0
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;

COMinit()


n, k = l_in()

if k >= n-1:
    print(mod_COM(2*n-1, n-1))
else:
    res = 0
    for r in range(0, k+1):
        res = mod_add(res, mod_mul(mod_COM(n-1, r), mod_COM(n, r)))

    print(res) def s_in():
    return input() s_in return input() input() input def n_in():
    return int(input()) n_in return int(input()) int(input()) int input() input def l_in():
    return list(map(int, input().split())) l_in return list(map(int, input().split())) list(map(int, input().split())) list map(int, input().split()) map int input().split() ().split () input split class Interval():
    def __init__(self, li):
        self.li = li
        self.n = len(li)
        self.sum_li = [li[0]]
        for i in range(1, self.n):
            self.sum_li.append(self.sum_li[i-1] + li[i])

    def sum(self, a, b=None):
        if b is None:
            return self.sum(0, a)

        res = self.sum_li[min(self.n-1, b-1)]
        if a > 0:
            res -= self.sum_li[a-1]
        return res Interval def __init__(self, li):
        self.li = li
        self.n = len(li)
        self.sum_li = [li[0]]
        for i in range(1, self.n):
            self.sum_li.append(self.sum_li[i-1] + li[i])

     __init__ self.li = li self.li self li li self.n = len(li) self.n self n len(li) len li self.sum_li = [li[0]] self.sum_li self sum_li [li[0]] li[0] li 0 for i in range(1, self.n):
            self.sum_li.append(self.sum_li[i-1] + li[i])

     i range(1, self.n) range 1 self.n self n self.sum_li.append(self.sum_li[i-1] + li[i]) self.sum_li.append self.sum_li self sum_li append self.sum_li[i-1] + li[i] self.sum_li[i-1] self.sum_li self sum_li i-1 i 1 li[i] li i self self li li def sum(self, a, b=None):
        if b is None:
            return self.sum(0, a)

        res = self.sum_li[min(self.n-1, b-1)]
        if a > 0:
            res -= self.sum_li[a-1]
        return res sum if b is None:
            return self.sum(0, a)

         b is None b None return self.sum(0, a) self.sum(0, a) self.sum self sum 0 a res = self.sum_li[min(self.n-1, b-1)] res self.sum_li[min(self.n-1, b-1)] self.sum_li self sum_li min(self.n-1, b-1) min self.n-1 self.n self n 1 b-1 b 1 if a > 0:
            res -= self.sum_li[a-1]
         a > 0 a 0 res -= self.sum_li[a-1] res self.sum_li[a-1] self.sum_li self sum_li a-1 a 1 return res res self self a a b=None b None def s_in():
    return input() s_in return input() input() input def n_in():
    return int(input()) n_in return int(input()) int(input()) int input() input def l_in():
    return list(map(int, input().split())) l_in return list(map(int, input().split())) list(map(int, input().split())) list map(int, input().split()) map int input().split() ().split () input split class Interval():
    def __init__(self, li):
        self.li = li
        self.n = len(li)
        self.sum_li = [li[0]]
        for i in range(1, self.n):
            self.sum_li.append(self.sum_li[i-1] + li[i])

    def sum(self, a, b=None):
        if b is None:
            return self.sum(0, a)

        res = self.sum_li[min(self.n-1, b-1)]
        if a > 0:
            res -= self.sum_li[a-1]
        return res Interval def __init__(self, li):
        self.li = li
        self.n = len(li)
        self.sum_li = [li[0]]
        for i in range(1, self.n):
            self.sum_li.append(self.sum_li[i-1] + li[i])

     __init__ self.li = li self.li self li li self.n = len(li) self.n self n len(li) len li self.sum_li = [li[0]] self.sum_li self sum_li [li[0]] li[0] li 0 for i in range(1, self.n):
            self.sum_li.append(self.sum_li[i-1] + li[i])

     i range(1, self.n) range 1 self.n self n self.sum_li.append(self.sum_li[i-1] + li[i]) self.sum_li.append self.sum_li self sum_li append self.sum_li[i-1] + li[i] self.sum_li[i-1] self.sum_li self sum_li i-1 i 1 li[i] li i self self li li def sum(self, a, b=None):
        if b is None:
            return self.sum(0, a)

        res = self.sum_li[min(self.n-1, b-1)]
        if a > 0:
            res -= self.sum_li[a-1]
        return res sum if b is None:
            return self.sum(0, a)

         b is None b None return self.sum(0, a) self.sum(0, a) self.sum self sum 0 a res = self.sum_li[min(self.n-1, b-1)] res self.sum_li[min(self.n-1, b-1)] self.sum_li self sum_li min(self.n-1, b-1) min self.n-1 self.n self n 1 b-1 b 1 if a > 0:
            res -= self.sum_li[a-1]
         a > 0 a 0 res -= self.sum_li[a-1] res self.sum_li[a-1] self.sum_li self sum_li a-1 a 1 return res res self self a a b=None b None MOD = 1000000007 MOD 1000000007 def mod_add(a, b):
  return (a+b)%MOD mod_add return (a+b)%MOD (a+b)%MOD a+b a b MOD a a b b def mod_sub(a, b):
  return (a+MOD-b)%MOD mod_sub return (a+MOD-b)%MOD (a+MOD-b)%MOD a+MOD-b a+MOD a MOD b MOD a a b b def mod_mul(a, b):
  return a*b%MOD

#互いに素なa,bについて、a*x+b*y=1の一つの解 mod_mul return a*b%MOD a*b%MOD a*b a b MOD a a b b def extgcd(a,b):
    r = (1,0,a)
    w = (0,1,b)
    while w[2]!=1:
        q = r[2]//w[2]
        r2 = w
        w2 = [r[0]-q*w[0],r[1]-q*w[1],r[2]-q*w[2]]
        r = r2
        w = w2
    return (w[0],w[1]) extgcd r = (1,0,a) r (1,0,a) 1 0 a w = (0,1,b) w (0,1,b) 0 1 b while w[2]!=1:
        q = r[2]//w[2]
        r2 = w
        w2 = [r[0]-q*w[0],r[1]-q*w[1],r[2]-q*w[2]]
        r = r2
        w = w2
     w[2]!=1 w[2] w 2 1 q = r[2]//w[2] q r[2]//w[2] r[2] r 2 w[2] w 2 r2 = w r2 w w2 = [r[0]-q*w[0],r[1]-q*w[1],r[2]-q*w[2]] w2 [r[0]-q*w[0],r[1]-q*w[1],r[2]-q*w[2]] r[0]-q*w[0] r[0] r 0 q*w[0] q w[0] w 0 r[1]-q*w[1] r[1] r 1 q*w[1] q w[1] w 1 r[2]-q*w[2] r[2] r 2 q*w[2] q w[2] w 2 r = r2 r r2 w = w2 w w2 return (w[0],w[1]) (w[0],w[1]) w[0] w 0 w[1] w 1 a a b b def mod_inv(a):
    x,_ = extgcd(a, MOD)
    return (MOD+x%MOD)%MOD mod_inv x,_ = extgcd(a, MOD) x extgcd(a, MOD) extgcd a MOD _ return (MOD+x%MOD)%MOD (MOD+x%MOD)%MOD MOD+x%MOD MOD x%MOD x MOD MOD a a def mod_div(a, b):
    return a*mod_inv(b)%MOD mod_div return a*mod_inv(b)%MOD a*mod_inv(b)%MOD a*mod_inv(b) a mod_inv(b) mod_inv b MOD a a b b def mod_pow(a, b):
    res = 1
    while b > 0:
        if b & 1:
            res = res * a % MOD
        a = a * a % MOD
        b >>= 1
    return res mod_pow res = 1 res 1 while b > 0:
        if b & 1:
            res = res * a % MOD
        a = a * a % MOD
        b >>= 1
     b > 0 b 0 if b & 1:
            res = res * a % MOD
         b & 1 b 1 res = res * a % MOD res res * a % MOD res * a res a MOD a = a * a % MOD a a * a % MOD a * a a a MOD b >>= 1 b 1 return res res a a b b MAX = 400001 MAX 400001 0 for _ in range(MAX) for _ in range(MAX) _ range(MAX) range MAX for _ in range(MAX) 0 fac  = [0 for _ in range(MAX)] fac [0 for _ in range(MAX)] 0 for _ in range(MAX) for _ in range(MAX) _ range(MAX) range MAX for _ in range(MAX) 0 finv = [0 for _ in range(MAX)] finv [0 for _ in range(MAX)] 0 for _ in range(MAX) for _ in range(MAX) _ range(MAX) range MAX for _ in range(MAX) 0 inv  = [0 for _ in range(MAX)] inv [0 for _ in range(MAX)] def COMinit():
    fac[0] = fac[1] = 1
    finv[0] = finv[1] = 1
    inv[1] = 1
    for i in range(2, MAX):
        fac[i] = fac[i - 1] * i % MOD
        inv[i] = MOD - inv[MOD%i] * (MOD // i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD; COMinit 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 inv[1] = 1 inv[1] inv 1 1 for i in range(2, MAX):
        fac[i] = fac[i - 1] * i % MOD
        inv[i] = MOD - inv[MOD%i] * (MOD // i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD; i range(2, MAX) range 2 MAX 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 inv[i] = MOD - inv[MOD%i] * (MOD // i) % MOD inv[i] inv i MOD - inv[MOD%i] * (MOD // i) % MOD MOD inv[MOD%i] * (MOD // i) % MOD inv[MOD%i] * (MOD // i) inv[MOD%i] inv MOD%i MOD i MOD // i MOD 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 mod_COM(n, k):
    if n < k:
        return 0
    if n < 0 or k < 0:
        return 0
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD; mod_COM if n < k:
        return 0
     n < k n k return 0 0 if n < 0 or k < 0:
        return 0
     n < 0 or k < 0 n < 0 n 0 k < 0 k 0 return 0 0 return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD fac[n] * (finv[k] * finv[n - k] % MOD) % MOD fac[n] * (finv[k] * finv[n - k] % MOD) fac[n] fac n finv[k] * finv[n - k] % MOD finv[k] * finv[n - k] finv[k] finv k finv[n - k] finv n - k n k MOD MOD n n k k COMinit() COMinit n, k = l_in() n l_in() l_in k if k >= n-1:
    print(mod_COM(2*n-1, n-1))
else:
    res = 0
    for r in range(0, k+1):
        res = mod_add(res, mod_mul(mod_COM(n-1, r), mod_COM(n, r)))

    print(res) k >= n-1 k n-1 n 1 print(mod_COM(2*n-1, n-1)) print mod_COM(2*n-1, n-1) mod_COM 2*n-1 2*n 2 n 1 n-1 n 1 res = 0 res 0 for r in range(0, k+1):
        res = mod_add(res, mod_mul(mod_COM(n-1, r), mod_COM(n, r)))

     r range(0, k+1) range 0 k+1 k 1 res = mod_add(res, mod_mul(mod_COM(n-1, r), mod_COM(n, r))) res mod_add(res, mod_mul(mod_COM(n-1, r), mod_COM(n, r))) mod_add res mod_mul(mod_COM(n-1, r), mod_COM(n, r)) mod_mul mod_COM(n-1, r) mod_COM n-1 n 1 r mod_COM(n, r) mod_COM n r print(res) print res def n_in():
    return int(input()) def n_in():
    return int(input()) n_in def extgcd(a,b):
    r = (1,0,a)
    w = (0,1,b)
    while w[2]!=1:
        q = r[2]//w[2]
        r2 = w
        w2 = [r[0]-q*w[0],r[1]-q*w[1],r[2]-q*w[2]]
        r = r2
        w = w2
    return (w[0],w[1]) def extgcd(a,b):
    r = (1,0,a)
    w = (0,1,b)
    while w[2]!=1:
        q = r[2]//w[2]
        r2 = w
        w2 = [r[0]-q*w[0],r[1]-q*w[1],r[2]-q*w[2]]
        r = r2
        w = w2
    return (w[0],w[1]) extgcd fac  = [0 for _ in range(MAX)] [0 for _ in range(MAX)] fac k = l_in() l_in() k n, k = l_in() l_in() n def mod_sub(a, b):
  return (a+MOD-b)%MOD def mod_sub(a, b):
  return (a+MOD-b)%MOD mod_sub def mod_inv(a):
    x,_ = extgcd(a, MOD)
    return (MOD+x%MOD)%MOD def mod_inv(a):
    x,_ = extgcd(a, MOD)
    return (MOD+x%MOD)%MOD mod_inv MOD = 1000000007 1000000007 MOD inv  = [0 for _ in range(MAX)] [0 for _ in range(MAX)] inv def l_in():
    return list(map(int, input().split())) def l_in():
    return list(map(int, input().split())) l_in MAX = 400001 400001 MAX def n_in():
    return int(input()) def n_in():
    return int(input()) n_in finv = [0 for _ in range(MAX)] [0 for _ in range(MAX)] finv def mod_COM(n, k):
    if n < k:
        return 0
    if n < 0 or k < 0:
        return 0
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD; def mod_COM(n, k):
    if n < k:
        return 0
    if n < 0 or k < 0:
        return 0
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD; mod_COM res = 0 0 res def mod_mul(a, b):
  return a*b%MOD

#互いに素なa,bについて、a*x+b*y=1の一つの解 def mod_mul(a, b):
  return a*b%MOD

#互いに素なa,bについて、a*x+b*y=1の一つの解 mod_mul def l_in():
    return list(map(int, input().split())) def l_in():
    return list(map(int, input().split())) l_in def COMinit():
    fac[0] = fac[1] = 1
    finv[0] = finv[1] = 1
    inv[1] = 1
    for i in range(2, MAX):
        fac[i] = fac[i - 1] * i % MOD
        inv[i] = MOD - inv[MOD%i] * (MOD // i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD; def COMinit():
    fac[0] = fac[1] = 1
    finv[0] = finv[1] = 1
    inv[1] = 1
    for i in range(2, MAX):
        fac[i] = fac[i - 1] * i % MOD
        inv[i] = MOD - inv[MOD%i] * (MOD // i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD; COMinit class Interval():
    def __init__(self, li):
        self.li = li
        self.n = len(li)
        self.sum_li = [li[0]]
        for i in range(1, self.n):
            self.sum_li.append(self.sum_li[i-1] + li[i])

    def sum(self, a, b=None):
        if b is None:
            return self.sum(0, a)

        res = self.sum_li[min(self.n-1, b-1)]
        if a > 0:
            res -= self.sum_li[a-1]
        return res class Interval():
    def __init__(self, li):
        self.li = li
        self.n = len(li)
        self.sum_li = [li[0]]
        for i in range(1, self.n):
            self.sum_li.append(self.sum_li[i-1] + li[i])

    def sum(self, a, b=None):
        if b is None:
            return self.sum(0, a)

        res = self.sum_li[min(self.n-1, b-1)]
        if a > 0:
            res -= self.sum_li[a-1]
        return res Interval res = mod_add(res, mod_mul(mod_COM(n-1, r), mod_COM(n, r))) mod_add(res, mod_mul(mod_COM(n-1, r), mod_COM(n, r))) res class Interval():
    def __init__(self, li):
        self.li = li
        self.n = len(li)
        self.sum_li = [li[0]]
        for i in range(1, self.n):
            self.sum_li.append(self.sum_li[i-1] + li[i])

    def sum(self, a, b=None):
        if b is None:
            return self.sum(0, a)

        res = self.sum_li[min(self.n-1, b-1)]
        if a > 0:
            res -= self.sum_li[a-1]
        return res class Interval():
    def __init__(self, li):
        self.li = li
        self.n = len(li)
        self.sum_li = [li[0]]
        for i in range(1, self.n):
            self.sum_li.append(self.sum_li[i-1] + li[i])

    def sum(self, a, b=None):
        if b is None:
            return self.sum(0, a)

        res = self.sum_li[min(self.n-1, b-1)]
        if a > 0:
            res -= self.sum_li[a-1]
        return res Interval def s_in():
    return input() def s_in():
    return input() s_in def s_in():
    return input() def s_in():
    return input() s_in def mod_div(a, b):
    return a*mod_inv(b)%MOD def mod_div(a, b):
    return a*mod_inv(b)%MOD mod_div def mod_pow(a, b):
    res = 1
    while b > 0:
        if b & 1:
            res = res * a % MOD
        a = a * a % MOD
        b >>= 1
    return res def mod_pow(a, b):
    res = 1
    while b > 0:
        if b & 1:
            res = res * a % MOD
        a = a * a % MOD
        b >>= 1
    return res mod_pow def mod_add(a, b):
  return (a+b)%MOD def mod_add(a, b):
  return (a+b)%MOD mod_add
def s_in():
    return input()

def n_in():
    return int(input())

def l_in():
    return list(map(int, input().split()))

class Interval():
    def __init__(self, li):
        self.li = li
        self.n = len(li)
        self.sum_li = [li[0]]
        for i in range(1, self.n):
            self.sum_li.append(self.sum_li[i-1] + li[i])

    def sum(self, a, b=None):
        if b is None:
            return self.sum(0, a)

        res = self.sum_li[min(self.n-1, b-1)]
        if a > 0:
            res -= self.sum_li[a-1]
        return res

def s_in():
    return input()

def n_in():
    return int(input())

def l_in():
    return list(map(int, input().split()))

class Interval():
    def __init__(self, li):
        self.li = li
        self.n = len(li)
        self.sum_li = [li[0]]
        for i in range(1, self.n):
            self.sum_li.append(self.sum_li[i-1] + li[i])

    def sum(self, a, b=None):
        if b is None:
            return self.sum(0, a)

        res = self.sum_li[min(self.n-1, b-1)]
        if a > 0:
            res -= self.sum_li[a-1]
        return res

MOD = 1000000007

def mod_add(a, b):
  return (a+b)%MOD

def mod_sub(a, b):
  return (a+MOD-b)%MOD

def mod_mul(a, b):
  return a*b%MOD

#互いに素なa,bについて、a*x+b*y=1の一つの解
def extgcd(a,b):
    r = (1,0,a)
    w = (0,1,b)
    while w[2]!=1:
        q = r[2]//w[2]
        r2 = w
        w2 = [r[0]-q*w[0],r[1]-q*w[1],r[2]-q*w[2]]
        r = r2
        w = w2
    return (w[0],w[1])

def mod_inv(a):
    x,_ = extgcd(a, MOD)
    return (MOD+x%MOD)%MOD

def mod_div(a, b):
    return a*mod_inv(b)%MOD

def mod_pow(a, b):
    res = 1
    while b > 0:
        if b & 1:
            res = res * a % MOD
        a = a * a % MOD
        b >>= 1
    return res


MAX = 400001

fac  = [0 for _ in range(MAX)]
finv = [0 for _ in range(MAX)]
inv  = [0 for _ in range(MAX)]

def COMinit():
    fac[0] = fac[1] = 1
    finv[0] = finv[1] = 1
    inv[1] = 1
    for i in range(2, MAX):
        fac[i] = fac[i - 1] * i % MOD
        inv[i] = MOD - inv[MOD%i] * (MOD // i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;

def mod_COM(n, k):
    if n < k:
        return 0
    if n < 0 or k < 0:
        return 0
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;

COMinit()


n, k = l_in()

if k >= n-1:
    print(mod_COM(2*n-1, n-1))
else:
    res = 0
    for r in range(0, k+1):
        res = mod_add(res, mod_mul(mod_COM(n-1, r), mod_COM(n, r)))

    print(res)
