import sys
input = sys.stdin.readline

MOD = 10**9+7

class Comb:
    def __init__(self, N):
        self.fac = [1] * (N+1)
        for i in range(2, N+1): self.fac[i] = self.fac[i-1] * i % MOD

    def pow(self, a, b):
        res = 1
        while b:
            if b & 1: res = res * a % MOD
            a = a**2 % MOD
            b >>= 1
        return res

    def pow2(self, a, b):
        return pow(a, b, MOD)

    def comb(self, n, r):
        if r < 0 or r > n: return 0
        return (self.fac[n] * self.pow2(self.fac[r], MOD-2)) % MOD * self.pow2(self.fac[n-r], MOD-2) % MOD

    def permutation(self, n, r):
        if r == 0: return 1
        return self.fac[n] * self.pow2(self.fac[n-r], MOD-2) % MOD

def main():
  N, K = list(map(int, input().split()))

  comb = Comb(N)
  ans = 0

  for i in range(min(N, K)+1):
      ans = ans + (comb.comb(N, i) * comb.comb(N-1, i) % MOD)
      ans %= MOD

  print(ans) 

if __name__ == '__main__':
  main() import sys sys input = sys.stdin.readline input sys.stdin.readline sys.stdin sys stdin readline MOD = 10**9+7 MOD 10**9+7 10**9 10 9 7 class Comb:
    def __init__(self, N):
        self.fac = [1] * (N+1)
        for i in range(2, N+1): self.fac[i] = self.fac[i-1] * i % MOD

    def pow(self, a, b):
        res = 1
        while b:
            if b & 1: res = res * a % MOD
            a = a**2 % MOD
            b >>= 1
        return res

    def pow2(self, a, b):
        return pow(a, b, MOD)

    def comb(self, n, r):
        if r < 0 or r > n: return 0
        return (self.fac[n] * self.pow2(self.fac[r], MOD-2)) % MOD * self.pow2(self.fac[n-r], MOD-2) % MOD

    def permutation(self, n, r):
        if r == 0: return 1
        return self.fac[n] * self.pow2(self.fac[n-r], MOD-2) % MOD Comb def __init__(self, N):
        self.fac = [1] * (N+1)
        for i in range(2, N+1): self.fac[i] = self.fac[i-1] * i % MOD

     __init__ self.fac = [1] * (N+1) self.fac self fac [1] * (N+1) [1] 1 N+1 N 1 for i in range(2, N+1): self.fac[i] = self.fac[i-1] * i % MOD

     i range(2, N+1) range 2 N+1 N 1 self self N N def pow(self, a, b):
        res = 1
        while b:
            if b & 1: res = res * a % MOD
            a = a**2 % MOD
            b >>= 1
        return res

     pow res = 1 res 1 while b:
            if b & 1: res = res * a % MOD
            a = a**2 % MOD
            b >>= 1
         b if b & 1: res = res * a % MOD
             b & 1 b 1 a = a**2 % MOD a a**2 % MOD a**2 a 2 MOD b >>= 1 b 1 return res res self self a a b b def pow2(self, a, b):
        return pow(a, b, MOD)

     pow2 return pow(a, b, MOD) pow(a, b, MOD) pow a b MOD self self a a b b def comb(self, n, r):
        if r < 0 or r > n: return 0
        return (self.fac[n] * self.pow2(self.fac[r], MOD-2)) % MOD * self.pow2(self.fac[n-r], MOD-2) % MOD

     comb if r < 0 or r > n: return 0
         r < 0 or r > n r < 0 r 0 r > n r n return (self.fac[n] * self.pow2(self.fac[r], MOD-2)) % MOD * self.pow2(self.fac[n-r], MOD-2) % MOD (self.fac[n] * self.pow2(self.fac[r], MOD-2)) % MOD * self.pow2(self.fac[n-r], MOD-2) % MOD (self.fac[n] * self.pow2(self.fac[r], MOD-2)) % MOD * self.pow2(self.fac[n-r], MOD-2) (self.fac[n] * self.pow2(self.fac[r], MOD-2)) % MOD self.fac[n] * self.pow2(self.fac[r], MOD-2) self.fac[n] self.fac self fac n self.pow2(self.fac[r], MOD-2) self.pow2 self pow2 self.fac[r] self.fac self fac r MOD-2 MOD 2 MOD self.pow2(self.fac[n-r], MOD-2) self.pow2 self pow2 self.fac[n-r] self.fac self fac n-r n r MOD-2 MOD 2 MOD self self n n r r def permutation(self, n, r):
        if r == 0: return 1
        return self.fac[n] * self.pow2(self.fac[n-r], MOD-2) % MOD permutation if r == 0: return 1
         r == 0 r 0 return self.fac[n] * self.pow2(self.fac[n-r], MOD-2) % MOD self.fac[n] * self.pow2(self.fac[n-r], MOD-2) % MOD self.fac[n] * self.pow2(self.fac[n-r], MOD-2) self.fac[n] self.fac self fac n self.pow2(self.fac[n-r], MOD-2) self.pow2 self pow2 self.fac[n-r] self.fac self fac n-r n r MOD-2 MOD 2 MOD self self n n r r def main():
  N, K = list(map(int, input().split()))

  comb = Comb(N)
  ans = 0

  for i in range(min(N, K)+1):
      ans = ans + (comb.comb(N, i) * comb.comb(N-1, i) % MOD)
      ans %= MOD

  print(ans)  main N, K = list(map(int, input().split())) N list(map(int, input().split())) list map(int, input().split()) map int input().split() ().split () input split K comb = Comb(N) comb Comb(N) Comb N ans = 0 ans 0 for i in range(min(N, K)+1):
      ans = ans + (comb.comb(N, i) * comb.comb(N-1, i) % MOD)
      ans %= MOD

   i range(min(N, K)+1) range min(N, K)+1 min(N, K) min N K 1 ans = ans + (comb.comb(N, i) * comb.comb(N-1, i) % MOD) ans ans + (comb.comb(N, i) * comb.comb(N-1, i) % MOD) ans comb.comb(N, i) * comb.comb(N-1, i) % MOD comb.comb(N, i) * comb.comb(N-1, i) comb.comb(N, i) comb.comb comb comb N i comb.comb(N-1, i) comb.comb comb comb N-1 N 1 i MOD ans %= MOD ans MOD print(ans) print ans if __name__ == '__main__':
  main() __name__ == '__main__' __name__ '__main__' main() main input = sys.stdin.readline sys.stdin.readline input MOD = 10**9+7 10**9+7 MOD class Comb:
    def __init__(self, N):
        self.fac = [1] * (N+1)
        for i in range(2, N+1): self.fac[i] = self.fac[i-1] * i % MOD

    def pow(self, a, b):
        res = 1
        while b:
            if b & 1: res = res * a % MOD
            a = a**2 % MOD
            b >>= 1
        return res

    def pow2(self, a, b):
        return pow(a, b, MOD)

    def comb(self, n, r):
        if r < 0 or r > n: return 0
        return (self.fac[n] * self.pow2(self.fac[r], MOD-2)) % MOD * self.pow2(self.fac[n-r], MOD-2) % MOD

    def permutation(self, n, r):
        if r == 0: return 1
        return self.fac[n] * self.pow2(self.fac[n-r], MOD-2) % MOD class Comb:
    def __init__(self, N):
        self.fac = [1] * (N+1)
        for i in range(2, N+1): self.fac[i] = self.fac[i-1] * i % MOD

    def pow(self, a, b):
        res = 1
        while b:
            if b & 1: res = res * a % MOD
            a = a**2 % MOD
            b >>= 1
        return res

    def pow2(self, a, b):
        return pow(a, b, MOD)

    def comb(self, n, r):
        if r < 0 or r > n: return 0
        return (self.fac[n] * self.pow2(self.fac[r], MOD-2)) % MOD * self.pow2(self.fac[n-r], MOD-2) % MOD

    def permutation(self, n, r):
        if r == 0: return 1
        return self.fac[n] * self.pow2(self.fac[n-r], MOD-2) % MOD Comb def main():
  N, K = list(map(int, input().split()))

  comb = Comb(N)
  ans = 0

  for i in range(min(N, K)+1):
      ans = ans + (comb.comb(N, i) * comb.comb(N-1, i) % MOD)
      ans %= MOD

  print(ans)  def main():
  N, K = list(map(int, input().split()))

  comb = Comb(N)
  ans = 0

  for i in range(min(N, K)+1):
      ans = ans + (comb.comb(N, i) * comb.comb(N-1, i) % MOD)
      ans %= MOD

  print(ans)  main
import sys
input = sys.stdin.readline

MOD = 10**9+7

class Comb:
    def __init__(self, N):
        self.fac = [1] * (N+1)
        for i in range(2, N+1): self.fac[i] = self.fac[i-1] * i % MOD

    def pow(self, a, b):
        res = 1
        while b:
            if b & 1: res = res * a % MOD
            a = a**2 % MOD
            b >>= 1
        return res

    def pow2(self, a, b):
        return pow(a, b, MOD)

    def comb(self, n, r):
        if r < 0 or r > n: return 0
        return (self.fac[n] * self.pow2(self.fac[r], MOD-2)) % MOD * self.pow2(self.fac[n-r], MOD-2) % MOD

    def permutation(self, n, r):
        if r == 0: return 1
        return self.fac[n] * self.pow2(self.fac[n-r], MOD-2) % MOD

def main():
  N, K = list(map(int, input().split()))

  comb = Comb(N)
  ans = 0

  for i in range(min(N, K)+1):
      ans = ans + (comb.comb(N, i) * comb.comb(N-1, i) % MOD)
      ans %= MOD

  print(ans) 

if __name__ == '__main__':
  main()