def cmb(n, r, mod):
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod

mod = 10**9+7 #出力の制限
N = 10**6
g1 = [1, 1] # 元テーブル
g2 = [1, 1] #逆元テーブル
inverse = [0, 1] #逆元テーブル計算用テーブル

for i in range( 2, N + 1 ):
    g1.append( ( g1[-1] * i ) % mod )
    inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
    g2.append( (g2[-1] * inverse[-1]) % mod )
a,b=map(int,input().split())
mod=(10**9)+7
if b>=a-1:
  print(cmb((2*a)-1, a,mod))
else:
  ans=0
  for i in range(1,b+1):
    ans+=cmb(a, i,mod)*cmb(a-1, a-i-1,mod)
  if b!=1:
    ans+=1
  print(ans%mod) def cmb(n, r, mod):
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod cmb if ( r<0 or r>n ):
        return 0
     r<0 or r>n r<0 r 0 r>n r n return 0 0 r = min(r, n-r) r min(r, n-r) min r n-r n r return g1[n] * g2[r] * g2[n-r] % mod g1[n] * g2[r] * g2[n-r] % mod g1[n] * g2[r] * g2[n-r] g1[n] * g2[r] g1[n] g1 n g2[r] g2 r g2[n-r] g2 n-r n r mod n n r r mod mod mod = 10**9+7 mod 10**9+7 10**9 10 9 7 N = 10**6 N 10**6 10 6 g1 = [1, 1] g1 [1, 1] 1 1 g2 = [1, 1] g2 [1, 1] 1 1 inverse = [0, 1] inverse [0, 1] 0 1 for i in range( 2, N + 1 ):
    g1.append( ( g1[-1] * i ) % mod )
    inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
    g2.append( (g2[-1] * inverse[-1]) % mod ) i range( 2, N + 1 ) range 2 N + 1 N 1 g1.append( ( g1[-1] * i ) % mod ) g1.append g1 append ( g1[-1] * i ) % mod g1[-1] * i g1[-1] g1 -1 i mod inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod ) inverse.append inverse append ( -inverse[mod % i] * (mod//i) ) % mod -inverse[mod % i] * (mod//i) -inverse[mod % i] inverse[mod % i] inverse mod % i mod i mod//i mod i mod g2.append( (g2[-1] * inverse[-1]) % mod ) g2.append g2 append (g2[-1] * inverse[-1]) % mod g2[-1] * inverse[-1] g2[-1] g2 -1 inverse[-1] inverse -1 mod a,b=map(int,input().split()) a map(int,input().split()) map int input().split() ().split () input split b mod=(10**9)+7 mod (10**9)+7 10**9 10 9 7 if b>=a-1:
  print(cmb((2*a)-1, a,mod))
else:
  ans=0
  for i in range(1,b+1):
    ans+=cmb(a, i,mod)*cmb(a-1, a-i-1,mod)
  if b!=1:
    ans+=1
  print(ans%mod) b>=a-1 b a-1 a 1 print(cmb((2*a)-1, a,mod)) print cmb((2*a)-1, a,mod) cmb (2*a)-1 2*a 2 a 1 a mod ans=0 ans 0 for i in range(1,b+1):
    ans+=cmb(a, i,mod)*cmb(a-1, a-i-1,mod)
   i range(1,b+1) range 1 b+1 b 1 ans+=cmb(a, i,mod)*cmb(a-1, a-i-1,mod) ans cmb(a, i,mod)*cmb(a-1, a-i-1,mod) cmb(a, i,mod) cmb a i mod cmb(a-1, a-i-1,mod) cmb a-1 a 1 a-i-1 a-i a i 1 mod if b!=1:
    ans+=1
   b!=1 b 1 ans+=1 ans 1 print(ans%mod) print ans%mod ans mod def cmb(n, r, mod):
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod def cmb(n, r, mod):
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod cmb N = 10**6 10**6 N a,b=map(int,input().split()) map(int,input().split()) a ans+=1 1 ans g2 = [1, 1] [1, 1] g2 mod=(10**9)+7 (10**9)+7 mod mod = 10**9+7 10**9+7 mod ans=0 0 ans ans+=cmb(a, i,mod)*cmb(a-1, a-i-1,mod) cmb(a, i,mod)*cmb(a-1, a-i-1,mod) ans g1 = [1, 1] [1, 1] g1 b=map(int,input().split()) map(int,input().split()) b inverse = [0, 1] [0, 1] inverse
def cmb(n, r, mod):
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod

mod = 10**9+7 #出力の制限
N = 10**6
g1 = [1, 1] # 元テーブル
g2 = [1, 1] #逆元テーブル
inverse = [0, 1] #逆元テーブル計算用テーブル

for i in range( 2, N + 1 ):
    g1.append( ( g1[-1] * i ) % mod )
    inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
    g2.append( (g2[-1] * inverse[-1]) % mod )
a,b=map(int,input().split())
mod=(10**9)+7
if b>=a-1:
  print(cmb((2*a)-1, a,mod))
else:
  ans=0
  for i in range(1,b+1):
    ans+=cmb(a, i,mod)*cmb(a-1, a-i-1,mod)
  if b!=1:
    ans+=1
  print(ans%mod)