n,k=list(map(int,input().split()))

def find_power(n,mod):

    # 0!からn!までのびっくりを出してくれる関数(ただし、modで割った値に対してである）

    powlist=[0]*(n+1)

    powlist[0]=1

    powlist[1]=1

    for i in range(2,n+1):

        powlist[i]=powlist[i-1]*i%(mod)

    return powlist



def find_inv_power(n):

    #0!からn!までの逆元を素数10**9+7で割ったあまりリストを作る関数

    powlist=find_power(n,10**9+7)

    check=powlist[-1]

    first=1

    uselist=[0]*(n+1)

    secondlist=[0]*30

    secondlist[0]=check

    secondlist[1]=check**2

    for i in range(28):

        secondlist[i+2]=(secondlist[i+1]**2)%(10**9+7)

    a=format(10**9+5,"b")

    for j in range(30):

        if a[29-j]=="1":

            first=(first*secondlist[j])%(10**9+7)

    uselist[n]=first

    for i in range(n,0,-1):

        uselist[i-1]=(uselist[i]*i)%(10**9+7)

    return uselist

mod=10**9+7

a=find_power(4*10**5+100,mod)

b=find_inv_power(4*10**5+100)

def combi(n,r,mod):

    if n<r:

        return 0

    elif n>=r:

        return (a[n]*b[r]*b[n-r])%(mod)

if n<=k:

    K=combi(2*n-1,n-1,mod)

    print(K)

    

else:

    K=combi(2*n-1,n-1,mod)

    for i in range(k+1,n):

        K-=combi(n-1,n-i-1,mod)*combi(n,i,mod)

    print((K%mod))

    

    

class Combi():

    def __init__(self, N, mod):

        self.power = [1 for _ in range(N+1)]

        self.rev = [1 for _ in range(N+1)]

        self.mod = mod

        for i in range(2, N+1):

            self.power[i] = (self.power[i-1]*i) % self.mod

        self.rev[N] = pow(self.power[N], self.mod-2, self.mod)

        for j in range(N, 0, -1):

            self.rev[j-1] = (self.rev[j]*j) % self.mod



    def com(self, K, R):

        if K < R:

            return 0

        else:

            return ((self.power[K])*(self.rev[K-R])*(self.rev[R])) % self.mod



    def pom(self, K, R):

        if K < R:

            return 0

        else:

            return (self.power[K])*(self.rev[K-R]) % self.mod





N, K = list(map(int, input().split()))

mod = 10**9+7

c = Combi(4*10**5+100, mod)

if N <= K:

    print((c.com(2*N-1, N-1)))

else:

    ans = c.com(2*N-1, N-1)

    for i in range(K+1, N):

        ans -= c.com(N-1, N-i-1)*c.com(N, i)

    print((ans % mod))
n, k = list(map(int, input().split()))


def find_power(n, mod):
    # 0!からn!までのびっくりを出してくれる関数(ただし、modで割った値に対してである）
    powlist = [0] * (n + 1)
    powlist[0] = 1
    powlist[1] = 1
    for i in range(2, n + 1):
        powlist[i] = powlist[i - 1] * i % (mod)
    return powlist


def find_inv_power(n):
    # 0!からn!までの逆元を素数10**9+7で割ったあまりリストを作る関数
    powlist = find_power(n, 10**9 + 7)
    check = powlist[-1]
    first = 1
    uselist = [0] * (n + 1)
    secondlist = [0] * 30
    secondlist[0] = check
    secondlist[1] = check**2
    for i in range(28):
        secondlist[i + 2] = (secondlist[i + 1] ** 2) % (10**9 + 7)
    a = format(10**9 + 5, "b")
    for j in range(30):
        if a[29 - j] == "1":
            first = (first * secondlist[j]) % (10**9 + 7)
    uselist[n] = first
    for i in range(n, 0, -1):
        uselist[i - 1] = (uselist[i] * i) % (10**9 + 7)
    return uselist


mod = 10**9 + 7
a = find_power(4 * 10**5 + 100, mod)
b = find_inv_power(4 * 10**5 + 100)


def combi(n, r, mod):
    if n < r:
        return 0
    elif n >= r:
        return (a[n] * b[r] * b[n - r]) % (mod)


if n <= k:
    K = combi(2 * n - 1, n - 1, mod)
    print(K)
else:
    K = combi(2 * n - 1, n - 1, mod)
    for i in range(k + 1, n):
        K -= combi(n - 1, n - i - 1, mod) * combi(n, i, mod)
    print((K % mod))

class Combi:
    def __init__(self, N, mod):
        self.power = [1 for _ in range(N + 1)]
        self.rev = [1 for _ in range(N + 1)]
        self.mod = mod
        for i in range(2, N + 1):
            self.power[i] = (self.power[i - 1] * i) % self.mod
        self.rev[N] = pow(self.power[N], self.mod - 2, self.mod)
        for j in range(N, 0, -1):
            self.rev[j - 1] = (self.rev[j] * j) % self.mod

    def com(self, K, R):
        if K < R:
            return 0
        else:
            return ((self.power[K]) * (self.rev[K - R]) * (self.rev[R])) % self.mod

    def pom(self, K, R):
        if K < R:
            return 0
        else:
            return (self.power[K]) * (self.rev[K - R]) % self.mod


N, K = list(map(int, input().split()))
mod = 10**9 + 7
c = Combi(4 * 10**5 + 100, mod)
if N <= K:
    print((c.com(2 * N - 1, N - 1)))
else:
    ans = c.com(2 * N - 1, N - 1)
    for i in range(K + 1, N):
        ans -= c.com(N - 1, N - i - 1) * c.com(N, i)
    print((ans % mod))

-n, k = list(map(int, input().split())) +class Combi: +    def __init__(self, N, mod): +        self.power = [1 for _ in range(N + 1)] +        self.rev = [1 for _ in range(N + 1)] +        self.mod = mod +        for i in range(2, N + 1): +            self.power[i] = (self.power[i - 1] * i) % self.mod +        self.rev[N] = pow(self.power[N], self.mod - 2, self.mod) +        for j in range(N, 0, -1): +            self.rev[j - 1] = (self.rev[j] * j) % self.mod + +    def com(self, K, R): +        if K < R: +            return 0 +        else: +            return ((self.power[K]) * (self.rev[K - R]) * (self.rev[R])) % self.mod + +    def pom(self, K, R): +        if K < R: +            return 0 +        else: +            return (self.power[K]) * (self.rev[K - R]) % self.mod -def find_power(n, mod): -    # 0!からn!までのびっくりを出してくれる関数(ただし、modで割った値に対してである） -    powlist = [0] * (n + 1) -    powlist[0] = 1 -    powlist[1] = 1 -    for i in range(2, n + 1): -        powlist[i] = powlist[i - 1] * i % (mod) -    return powlist - - -def find_inv_power(n): -    # 0!からn!までの逆元を素数10**9+7で割ったあまりリストを作る関数 -    powlist = find_power(n, 10**9 + 7) -    check = powlist[-1] -    first = 1 -    uselist = [0] * (n + 1) -    secondlist = [0] * 30 -    secondlist[0] = check -    secondlist[1] = check**2 -    for i in range(28): -        secondlist[i + 2] = (secondlist[i + 1] ** 2) % (10**9 + 7) -    a = format(10**9 + 5, "b") -    for j in range(30): -        if a[29 - j] == "1": -            first = (first * secondlist[j]) % (10**9 + 7) -    uselist[n] = first -    for i in range(n, 0, -1): -        uselist[i - 1] = (uselist[i] * i) % (10**9 + 7) -    return uselist - - +N, K = list(map(int, input().split())) -a = find_power(4 * 10**5 + 100, mod) -b = find_inv_power(4 * 10**5 + 100) - - -def combi(n, r, mod): -    if n < r: -        return 0 -    elif n >= r: -        return (a[n] * b[r] * b[n - r]) % (mod) - - -if n <= k: -    K = combi(2 * n - 1, n - 1, mod) -    print(K) +c = Combi(4 * 10**5 + 100, mod) +if N <= K: +    print((c.com(2 * N - 1, N - 1))) -    K = combi(2 * n - 1, n - 1, mod) -    for i in range(k + 1, n): -        K -= combi(n - 1, n - i - 1, mod) * combi(n, i, mod) -    print((K % mod)) +    ans = c.com(2 * N - 1, N - 1) +    for i in range(K + 1, N): +        ans -= c.com(N - 1, N - i - 1) * c.com(N, i) +    print((ans % mod))