n,k=map(int,input().split())
mi = min(n-1,k)
di = 10**9+7
def pow_k(x,i):
    if i==0:
        return 0
    K=1
    while i>1:
        if i % 2 != 0:
            K = (K*x)%di
        x = (x*x)%di
        i //= 2

    return (K * x)%di

lis = [i for i in range(n+1)]
lisr = [i for i in range(n+1)]
lis[0]=1
for i in range(1,n+1):
    lis[i]=(lis[i-1]*lis[i])%di
    lisr[i] = pow_k(lisr[i],di-2)

lisr[0]=1
for i in range(1,n+1):
    lisr[i]=(lisr[i-1]*lisr[i])%di

#print(lis,lisr)

su = 1
for i in range(1,mi+1):
    pl = ((((lis[n-1]*lisr[i])%di)*lisr[n-1-i])%di)
    plu = (pl*((((lis[n]*lisr[i])%di)*lisr[n-i])%di))%di
    su+=plu
    su%=di
print(su) n,k=map(int,input().split()) n map(int,input().split()) map int input().split() ().split () input split k mi = min(n-1,k) mi min(n-1,k) min n-1 n 1 k di = 10**9+7 di 10**9+7 10**9 10 9 7 def pow_k(x,i):
    if i==0:
        return 0
    K=1
    while i>1:
        if i % 2 != 0:
            K = (K*x)%di
        x = (x*x)%di
        i //= 2

    return (K * x)%di pow_k if i==0:
        return 0
     i==0 i 0 return 0 0 K=1 K 1 while i>1:
        if i % 2 != 0:
            K = (K*x)%di
        x = (x*x)%di
        i //= 2

     i>1 i 1 if i % 2 != 0:
            K = (K*x)%di
         i % 2 != 0 i % 2 i 2 0 K = (K*x)%di K (K*x)%di K*x K x di x = (x*x)%di x (x*x)%di x*x x x di i //= 2 i 2 return (K * x)%di (K * x)%di K * x K x di x x i i i for i in range(n+1) for i in range(n+1) i range(n+1) range n+1 n 1 for i in range(n+1) i lis = [i for i in range(n+1)] lis [i for i in range(n+1)] i for i in range(n+1) for i in range(n+1) i range(n+1) range n+1 n 1 for i in range(n+1) i lisr = [i for i in range(n+1)] lisr [i for i in range(n+1)] lis[0]=1 lis[0] lis 0 1 for i in range(1,n+1):
    lis[i]=(lis[i-1]*lis[i])%di
    lisr[i] = pow_k(lisr[i],di-2) i range(1,n+1) range 1 n+1 n 1 lis[i]=(lis[i-1]*lis[i])%di lis[i] lis i (lis[i-1]*lis[i])%di lis[i-1]*lis[i] lis[i-1] lis i-1 i 1 lis[i] lis i di lisr[i] = pow_k(lisr[i],di-2) lisr[i] lisr i pow_k(lisr[i],di-2) pow_k lisr[i] lisr i di-2 di 2 lisr[0]=1 lisr[0] lisr 0 1 for i in range(1,n+1):
    lisr[i]=(lisr[i-1]*lisr[i])%di

#print(lis,lisr) i range(1,n+1) range 1 n+1 n 1 lisr[i]=(lisr[i-1]*lisr[i])%di lisr[i] lisr i (lisr[i-1]*lisr[i])%di lisr[i-1]*lisr[i] lisr[i-1] lisr i-1 i 1 lisr[i] lisr i di su = 1 su 1 for i in range(1,mi+1):
    pl = ((((lis[n-1]*lisr[i])%di)*lisr[n-1-i])%di)
    plu = (pl*((((lis[n]*lisr[i])%di)*lisr[n-i])%di))%di
    su+=plu
    su%=di i range(1,mi+1) range 1 mi+1 mi 1 pl = ((((lis[n-1]*lisr[i])%di)*lisr[n-1-i])%di) pl (((lis[n-1]*lisr[i])%di)*lisr[n-1-i])%di ((lis[n-1]*lisr[i])%di)*lisr[n-1-i] (lis[n-1]*lisr[i])%di lis[n-1]*lisr[i] lis[n-1] lis n-1 n 1 lisr[i] lisr i di lisr[n-1-i] lisr n-1-i n-1 n 1 i di plu = (pl*((((lis[n]*lisr[i])%di)*lisr[n-i])%di))%di plu (pl*((((lis[n]*lisr[i])%di)*lisr[n-i])%di))%di pl*((((lis[n]*lisr[i])%di)*lisr[n-i])%di) pl (((lis[n]*lisr[i])%di)*lisr[n-i])%di ((lis[n]*lisr[i])%di)*lisr[n-i] (lis[n]*lisr[i])%di lis[n]*lisr[i] lis[n] lis n lisr[i] lisr i di lisr[n-i] lisr n-i n i di di su+=plu su plu su%=di su di print(su) print su lis = [i for i in range(n+1)] [i for i in range(n+1)] lis plu = (pl*((((lis[n]*lisr[i])%di)*lisr[n-i])%di))%di (pl*((((lis[n]*lisr[i])%di)*lisr[n-i])%di))%di plu di = 10**9+7 10**9+7 di k=map(int,input().split()) map(int,input().split()) k su+=plu plu su n,k=map(int,input().split()) map(int,input().split()) n def pow_k(x,i):
    if i==0:
        return 0
    K=1
    while i>1:
        if i % 2 != 0:
            K = (K*x)%di
        x = (x*x)%di
        i //= 2

    return (K * x)%di def pow_k(x,i):
    if i==0:
        return 0
    K=1
    while i>1:
        if i % 2 != 0:
            K = (K*x)%di
        x = (x*x)%di
        i //= 2

    return (K * x)%di pow_k su = 1 1 su lisr = [i for i in range(n+1)] [i for i in range(n+1)] lisr su%=di di su pl = ((((lis[n-1]*lisr[i])%di)*lisr[n-1-i])%di) (((lis[n-1]*lisr[i])%di)*lisr[n-1-i])%di pl mi = min(n-1,k) min(n-1,k) mi
n,k=map(int,input().split())
mi = min(n-1,k)
di = 10**9+7
def pow_k(x,i):
    if i==0:
        return 0
    K=1
    while i>1:
        if i % 2 != 0:
            K = (K*x)%di
        x = (x*x)%di
        i //= 2

    return (K * x)%di

lis = [i for i in range(n+1)]
lisr = [i for i in range(n+1)]
lis[0]=1
for i in range(1,n+1):
    lis[i]=(lis[i-1]*lis[i])%di
    lisr[i] = pow_k(lisr[i],di-2)

lisr[0]=1
for i in range(1,n+1):
    lisr[i]=(lisr[i-1]*lisr[i])%di

#print(lis,lisr)

su = 1
for i in range(1,mi+1):
    pl = ((((lis[n-1]*lisr[i])%di)*lisr[n-1-i])%di)
    plu = (pl*((((lis[n]*lisr[i])%di)*lisr[n-i])%di))%di
    su+=plu
    su%=di
print(su)
