#import sys
#import numpy as np
import math
#from fractions import Fraction
import itertools
from collections import deque
from collections import Counter
#import heapq
#from fractions  import gcd
#input=sys.stdin.readline
import bisect
n,k=map(int,input().split())

Mod=10**9+7
M=2*10**5 +1#書き換え

fac=[0]*M
finv=[0]*M
inv=[0]*M

#finvに逆元、facに階乗のmod
def COMinit():
  fac[0]=fac[1]=1
  finv[0]=finv[1]=1
  inv[1]=1
  for i in range(2,M):
    fac[i]=(fac[i-1]*i%Mod)%Mod
    inv[i]=Mod-inv[Mod%i]*(Mod//i) %Mod
    finv[i]=(finv[i-1]*inv[i]%Mod)%Mod
def 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

COMinit()
if n>k:
    ans=1
    for i in range(1,k+1):
        ans+=(COM(n,i)*COM(n-1,i))%Mod
        ans%=Mod
else:
    ans=1
    for i in range(1,n):
        ans+=(COM(n,i)*COM(n-1,i))%Mod
        ans%=Mod
print(ans) import math math import itertools itertools from collections import deque from collections import Counter import bisect bisect n,k=map(int,input().split()) n map(int,input().split()) map int input().split() ().split () input split k Mod=10**9+7 Mod 10**9+7 10**9 10 9 7 M=2*10**5 +1 M 2*10**5 +1 2*10**5 2 10**5 10 5 1 fac=[0]*M fac [0]*M [0] 0 M finv=[0]*M finv [0]*M [0] 0 M inv=[0]*M inv [0]*M [0] 0 M def COMinit():
  fac[0]=fac[1]=1
  finv[0]=finv[1]=1
  inv[1]=1
  for i in range(2,M):
    fac[i]=(fac[i-1]*i%Mod)%Mod
    inv[i]=Mod-inv[Mod%i]*(Mod//i) %Mod
    finv[i]=(finv[i-1]*inv[i]%Mod)%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,M):
    fac[i]=(fac[i-1]*i%Mod)%Mod
    inv[i]=Mod-inv[Mod%i]*(Mod//i) %Mod
    finv[i]=(finv[i-1]*inv[i]%Mod)%Mod i range(2,M) range 2 M fac[i]=(fac[i-1]*i%Mod)%Mod fac[i] fac i (fac[i-1]*i%Mod)%Mod fac[i-1]*i%Mod fac[i-1]*i fac[i-1] fac i-1 i 1 i Mod 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)%Mod finv[i] finv i (finv[i-1]*inv[i]%Mod)%Mod finv[i-1]*inv[i]%Mod finv[i-1]*inv[i] finv[i-1] finv i-1 i 1 inv[i] inv i Mod Mod def 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)%Mod (fac[n]*(finv[k]*finv[n-k]%Mod)%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 Mod n n k k COMinit() COMinit if n>k:
    ans=1
    for i in range(1,k+1):
        ans+=(COM(n,i)*COM(n-1,i))%Mod
        ans%=Mod
else:
    ans=1
    for i in range(1,n):
        ans+=(COM(n,i)*COM(n-1,i))%Mod
        ans%=Mod n>k n k ans=1 ans 1 for i in range(1,k+1):
        ans+=(COM(n,i)*COM(n-1,i))%Mod
        ans%=Mod i range(1,k+1) range 1 k+1 k 1 ans+=(COM(n,i)*COM(n-1,i))%Mod ans (COM(n,i)*COM(n-1,i))%Mod COM(n,i)*COM(n-1,i) COM(n,i) COM n i COM(n-1,i) COM n-1 n 1 i Mod ans%=Mod ans Mod ans=1 ans 1 for i in range(1,n):
        ans+=(COM(n,i)*COM(n-1,i))%Mod
        ans%=Mod i range(1,n) range 1 n ans+=(COM(n,i)*COM(n-1,i))%Mod ans (COM(n,i)*COM(n-1,i))%Mod COM(n,i)*COM(n-1,i) COM(n,i) COM n i COM(n-1,i) COM n-1 n 1 i Mod ans%=Mod ans Mod print(ans) print ans ans=1 1 ans ans=1 1 ans ans%=Mod Mod ans Mod=10**9+7 10**9+7 Mod finv=[0]*M [0]*M finv M=2*10**5 +1 2*10**5 +1 M k=map(int,input().split()) map(int,input().split()) k ans+=(COM(n,i)*COM(n-1,i))%Mod (COM(n,i)*COM(n-1,i))%Mod ans n,k=map(int,input().split()) map(int,input().split()) n def 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 def 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 fac=[0]*M [0]*M fac ans+=(COM(n,i)*COM(n-1,i))%Mod (COM(n,i)*COM(n-1,i))%Mod ans def COMinit():
  fac[0]=fac[1]=1
  finv[0]=finv[1]=1
  inv[1]=1
  for i in range(2,M):
    fac[i]=(fac[i-1]*i%Mod)%Mod
    inv[i]=Mod-inv[Mod%i]*(Mod//i) %Mod
    finv[i]=(finv[i-1]*inv[i]%Mod)%Mod def COMinit():
  fac[0]=fac[1]=1
  finv[0]=finv[1]=1
  inv[1]=1
  for i in range(2,M):
    fac[i]=(fac[i-1]*i%Mod)%Mod
    inv[i]=Mod-inv[Mod%i]*(Mod//i) %Mod
    finv[i]=(finv[i-1]*inv[i]%Mod)%Mod COMinit ans%=Mod Mod ans inv=[0]*M [0]*M inv
#import sys
#import numpy as np
import math
#from fractions import Fraction
import itertools
from collections import deque
from collections import Counter
#import heapq
#from fractions  import gcd
#input=sys.stdin.readline
import bisect
n,k=map(int,input().split())

Mod=10**9+7
M=2*10**5 +1#書き換え

fac=[0]*M
finv=[0]*M
inv=[0]*M

#finvに逆元、facに階乗のmod
def COMinit():
  fac[0]=fac[1]=1
  finv[0]=finv[1]=1
  inv[1]=1
  for i in range(2,M):
    fac[i]=(fac[i-1]*i%Mod)%Mod
    inv[i]=Mod-inv[Mod%i]*(Mod//i) %Mod
    finv[i]=(finv[i-1]*inv[i]%Mod)%Mod
def 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

COMinit()
if n>k:
    ans=1
    for i in range(1,k+1):
        ans+=(COM(n,i)*COM(n-1,i))%Mod
        ans%=Mod
else:
    ans=1
    for i in range(1,n):
        ans+=(COM(n,i)*COM(n-1,i))%Mod
        ans%=Mod
print(ans)