class Combinatorics: def __init__(self, n: int, mod: int) -> None: self.n = n self.mod = mod self.fa = [1] * (self.n + 1) self.fi = [1] * (self.n + 1) for i in range(1, self.n + 1): self.fa[i] = self.fa[i - 1] * i % self.mod self.fi[-1] = pow(self.fa[-1], self.mod - 2, self.mod) for i in range(self.n, 0, -1): self.fi[i - 1] = self.fi[i] * i % self.mod def comb(self, n: int, r: int) -> int: if n < r:return 0 if n < 0 or r < 0:return 0 return self.fa[n] * self.fi[r] % self.mod * self.fi[n - r] % self.mod def perm(self, n: int, r: int) -> int: if n < r:return 0 if n < 0 or r < 0:return 0 return self.fa[n] * self.fi[n - r] % self.mod def combr(self, n: int, r: int) -> int: if n == r == 0:return 1 return self.comb(n + r - 1, r) import typing # 拡張Euclidの互除法 def extgcd(a: int, b: int, d: int = 0) -> typing.Tuple[int, int, int]: g = a if b == 0: x, y = 1, 0 else: x, y, g = extgcd(b, a % b) x, y = y, x - a // b * y return x, y, g # mod p における逆元 def invmod(a: int, p: int) -> int: x, y, g = extgcd(a, p) x %= p return x n, k = map(int, input().split()) mod = 10 ** 9 + 7 C = Combinatorics(n, mod) cnt = 1 for i in range(1, n + 1): cnt *= (k - i + 1) cnt *= invmod(i, mod) cnt %= mod if k < n: cnt = 0 ans = 0 ans += cnt * C.comb(n - 1, 0) for i in range(1, n + 1): cnt *= k + i cnt *= invmod(k + i - n, mod) cnt %= mod if k + i == n: cnt = 1 ans += cnt * C.comb(n - 1, i) ans %= mod print(ans % (mod))