N, M = map(int, input().split()) MOD = 10 ** 9 + 7 modinv = lambda a, mod=MOD: pow(a, -1, mod) tmp = 1 ans = 1 for i in range(N + 1, M + 1): tmp = tmp * i * modinv(i - N) % MOD ans = (ans + tmp) % MOD print(ans)