def combinations(n,k,mod):
    x,y = 1,1
    for i in range(k):
        x = (x*(n-i))%mod
        y = (y*(i+1))%mod
    return (x*pow(y,mod-2,mod))%mod
    

mod = 10**9+7
n,k = map(int,input().split())

def cmap(n,k):
    x = [1]
    y = [1]
    c = [1]
    for i in range(k+1):
        x.append((x[i]*(n-i))%mod)
        y.append((y[i]*(i+1))%mod)
        c.append((x[i+1]*pow(y[i+1],mod-2,mod))%mod)
    return c
    
#print(cmap(n,n))
nc=cmap(n,n-1)
n1c=cmap(n-1,n-2)

ans = 0
for i in range(min(n-1,k)+1):
    ans = (ans+(nc[i]*n1c[i]))%mod

print(ans) def combinations(n,k,mod):
    x,y = 1,1
    for i in range(k):
        x = (x*(n-i))%mod
        y = (y*(i+1))%mod
    return (x*pow(y,mod-2,mod))%mod
     combinations x,y = 1,1 x 1 y 1 for i in range(k):
        x = (x*(n-i))%mod
        y = (y*(i+1))%mod
     i range(k) range k x = (x*(n-i))%mod x (x*(n-i))%mod x*(n-i) x n-i n i mod y = (y*(i+1))%mod y (y*(i+1))%mod y*(i+1) y i+1 i 1 mod return (x*pow(y,mod-2,mod))%mod (x*pow(y,mod-2,mod))%mod x*pow(y,mod-2,mod) x pow(y,mod-2,mod) pow y mod-2 mod 2 mod mod n n k k mod mod mod = 10**9+7 mod 10**9+7 10**9 10 9 7 n,k = map(int,input().split()) n map(int,input().split()) map int input().split() ().split () input split k def cmap(n,k):
    x = [1]
    y = [1]
    c = [1]
    for i in range(k+1):
        x.append((x[i]*(n-i))%mod)
        y.append((y[i]*(i+1))%mod)
        c.append((x[i+1]*pow(y[i+1],mod-2,mod))%mod)
    return c
    
#print(cmap(n,n)) cmap x = [1] x [1] 1 y = [1] y [1] 1 c = [1] c [1] 1 for i in range(k+1):
        x.append((x[i]*(n-i))%mod)
        y.append((y[i]*(i+1))%mod)
        c.append((x[i+1]*pow(y[i+1],mod-2,mod))%mod)
     i range(k+1) range k+1 k 1 x.append((x[i]*(n-i))%mod) x.append x append (x[i]*(n-i))%mod x[i]*(n-i) x[i] x i n-i n i mod y.append((y[i]*(i+1))%mod) y.append y append (y[i]*(i+1))%mod y[i]*(i+1) y[i] y i i+1 i 1 mod c.append((x[i+1]*pow(y[i+1],mod-2,mod))%mod) c.append c append (x[i+1]*pow(y[i+1],mod-2,mod))%mod x[i+1]*pow(y[i+1],mod-2,mod) x[i+1] x i+1 i 1 pow(y[i+1],mod-2,mod) pow y[i+1] y i+1 i 1 mod-2 mod 2 mod mod return c c n n k k nc=cmap(n,n-1) nc cmap(n,n-1) cmap n n-1 n 1 n1c=cmap(n-1,n-2) n1c cmap(n-1,n-2) cmap n-1 n 1 n-2 n 2 ans = 0 ans 0 for i in range(min(n-1,k)+1):
    ans = (ans+(nc[i]*n1c[i]))%mod i range(min(n-1,k)+1) range min(n-1,k)+1 min(n-1,k) min n-1 n 1 k 1 ans = (ans+(nc[i]*n1c[i]))%mod ans (ans+(nc[i]*n1c[i]))%mod ans+(nc[i]*n1c[i]) ans nc[i]*n1c[i] nc[i] nc i n1c[i] n1c i mod print(ans) print ans def combinations(n,k,mod):
    x,y = 1,1
    for i in range(k):
        x = (x*(n-i))%mod
        y = (y*(i+1))%mod
    return (x*pow(y,mod-2,mod))%mod
     def combinations(n,k,mod):
    x,y = 1,1
    for i in range(k):
        x = (x*(n-i))%mod
        y = (y*(i+1))%mod
    return (x*pow(y,mod-2,mod))%mod
     combinations nc=cmap(n,n-1) cmap(n,n-1) nc n,k = map(int,input().split()) map(int,input().split()) n mod = 10**9+7 10**9+7 mod ans = (ans+(nc[i]*n1c[i]))%mod (ans+(nc[i]*n1c[i]))%mod ans n1c=cmap(n-1,n-2) cmap(n-1,n-2) n1c ans = 0 0 ans def cmap(n,k):
    x = [1]
    y = [1]
    c = [1]
    for i in range(k+1):
        x.append((x[i]*(n-i))%mod)
        y.append((y[i]*(i+1))%mod)
        c.append((x[i+1]*pow(y[i+1],mod-2,mod))%mod)
    return c
    
#print(cmap(n,n)) def cmap(n,k):
    x = [1]
    y = [1]
    c = [1]
    for i in range(k+1):
        x.append((x[i]*(n-i))%mod)
        y.append((y[i]*(i+1))%mod)
        c.append((x[i+1]*pow(y[i+1],mod-2,mod))%mod)
    return c
    
#print(cmap(n,n)) cmap k = map(int,input().split()) map(int,input().split()) k
def combinations(n,k,mod):
    x,y = 1,1
    for i in range(k):
        x = (x*(n-i))%mod
        y = (y*(i+1))%mod
    return (x*pow(y,mod-2,mod))%mod
    

mod = 10**9+7
n,k = map(int,input().split())

def cmap(n,k):
    x = [1]
    y = [1]
    c = [1]
    for i in range(k+1):
        x.append((x[i]*(n-i))%mod)
        y.append((y[i]*(i+1))%mod)
        c.append((x[i+1]*pow(y[i+1],mod-2,mod))%mod)
    return c
    
#print(cmap(n,n))
nc=cmap(n,n-1)
n1c=cmap(n-1,n-2)

ans = 0
for i in range(min(n-1,k)+1):
    ans = (ans+(nc[i]*n1c[i]))%mod

print(ans)