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

f = [ 1 ] * ( n + 1 ) 
inv = [ 1 ] * ( n + 1 )

for i in range( 1, n + 1 ):
  f[ i ] = ( f[ i - 1 ] * i ) % mod
  
inv[ n ] = pow( f[ n ], mod - 2, mod )
for i in range( n, 0, - 1 ):
  inv[ i - 1 ] = ( inv[ i ] * i ) % mod
  
def nCr( n, r ):
  if r < 1:
    return 1
  return ( f[ n ] * inv[ r ] % mod ) * inv[ n - r ] % mod

ans = 0
for i in range( min( k, n - 1 ) + 1 ):
  ans = ( ans + nCr( n, i ) * nCr( n - 1, i ) ) % mod
  
print( ans )

 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 f = [ 1 ] * ( n + 1 ) f [ 1 ] * ( n + 1 ) [ 1 ] 1 n + 1 n 1 inv = [ 1 ] * ( n + 1 ) inv [ 1 ] * ( n + 1 ) [ 1 ] 1 n + 1 n 1 for i in range( 1, n + 1 ):
  f[ i ] = ( f[ i - 1 ] * i ) % mod
   i range( 1, n + 1 ) range 1 n + 1 n 1 f[ i ] = ( f[ i - 1 ] * i ) % mod f[ i ] f i ( f[ i - 1 ] * i ) % mod f[ i - 1 ] * i f[ i - 1 ] f i - 1 i 1 i mod inv[ n ] = pow( f[ n ], mod - 2, mod ) inv[ n ] inv n pow( f[ n ], mod - 2, mod ) pow f[ n ] f n mod - 2 mod 2 mod for i in range( n, 0, - 1 ):
  inv[ i - 1 ] = ( inv[ i ] * i ) % mod
   i range( n, 0, - 1 ) range n 0 - 1 inv[ i - 1 ] = ( inv[ i ] * i ) % mod inv[ i - 1 ] inv i - 1 i 1 ( inv[ i ] * i ) % mod inv[ i ] * i inv[ i ] inv i i mod def nCr( n, r ):
  if r < 1:
    return 1
  return ( f[ n ] * inv[ r ] % mod ) * inv[ n - r ] % mod nCr if r < 1:
    return 1
   r < 1 r 1 return 1 1 return ( f[ n ] * inv[ r ] % mod ) * inv[ n - r ] % mod ( f[ n ] * inv[ r ] % mod ) * inv[ n - r ] % mod ( f[ n ] * inv[ r ] % mod ) * inv[ n - r ] f[ n ] * inv[ r ] % mod f[ n ] * inv[ r ] f[ n ] f n inv[ r ] inv r mod inv[ n - r ] inv n - r n r mod n n r r ans = 0 ans 0 for i in range( min( k, n - 1 ) + 1 ):
  ans = ( ans + nCr( n, i ) * nCr( n - 1, i ) ) % mod
   i range( min( k, n - 1 ) + 1 ) range min( k, n - 1 ) + 1 min( k, n - 1 ) min k n - 1 n 1 1 ans = ( ans + nCr( n, i ) * nCr( n - 1, i ) ) % mod ans ( ans + nCr( n, i ) * nCr( n - 1, i ) ) % mod ans + nCr( n, i ) * nCr( n - 1, i ) ans nCr( n, i ) * nCr( n - 1, i ) nCr( n, i ) nCr n i nCr( n - 1, i ) nCr n - 1 n 1 i mod print( ans ) print ans ans = ( ans + nCr( n, i ) * nCr( n - 1, i ) ) % mod ( ans + nCr( n, i ) * nCr( n - 1, i ) ) % mod ans inv = [ 1 ] * ( n + 1 ) [ 1 ] * ( n + 1 ) inv f = [ 1 ] * ( n + 1 ) [ 1 ] * ( n + 1 ) f def nCr( n, r ):
  if r < 1:
    return 1
  return ( f[ n ] * inv[ r ] % mod ) * inv[ n - r ] % mod def nCr( n, r ):
  if r < 1:
    return 1
  return ( f[ n ] * inv[ r ] % mod ) * inv[ n - r ] % mod nCr ans = 0 0 ans k = map( int, input().split() ) map( int, input().split() ) k n, k = map( int, input().split() ) map( int, input().split() ) n mod = 10 ** 9 + 7 10 ** 9 + 7 mod
n, k = map( int, input().split() )
mod = 10 ** 9 + 7

f = [ 1 ] * ( n + 1 ) 
inv = [ 1 ] * ( n + 1 )

for i in range( 1, n + 1 ):
  f[ i ] = ( f[ i - 1 ] * i ) % mod
  
inv[ n ] = pow( f[ n ], mod - 2, mod )
for i in range( n, 0, - 1 ):
  inv[ i - 1 ] = ( inv[ i ] * i ) % mod
  
def nCr( n, r ):
  if r < 1:
    return 1
  return ( f[ n ] * inv[ r ] % mod ) * inv[ n - r ] % mod

ans = 0
for i in range( min( k, n - 1 ) + 1 ):
  ans = ( ans + nCr( n, i ) * nCr( n - 1, i ) ) % mod
  
print( ans )


