mod = 10 ** 9 + 7 def comb(m, r): if m < r:return 0 if m < 0 or r < 0:return 0 return fa[m] * fi[r] % mod * fi[m - r] % mod n, m = map(int, input().split()) fa = [1] * (m + 1) fi = [1] * (m + 1) for i in range(1, m + 1): fa[i] = fa[i - 1] * i % mod fi[i] = pow(fa[i], mod - 2, mod) ans = 0 for i in range(n, m + 1): ans += comb(i, n) ans %= mod print(ans)