#include <iostream>

#define MOD   1'000'000'007

using namespace std;

constexpr unsigned int pow_mod(const unsigned long long a, const unsigned long long b, const unsigned int mod)
{
	return (b == 0 ? (mod == 1 ? 0 : 1) : (b & 1 ? a % mod : 1) * pow_mod((a % mod) * (a % mod) % mod, b >> 1, mod) % mod);
}

int main()
{
	cin.tie(nullptr);
	ios::sync_with_stdio(false);

	int N, M, i, cur = 1, ans, div;
	cin >> N >> M;
	for (i = 1; i <= N; ++i)
		cur = static_cast<long long>(cur) * i % MOD;

	div = ans = cur;
	for (i = N + 1; i <= M; ++i)
		ans = (ans + (cur = static_cast<long long>(cur) * pow_mod(i - N, MOD - 2, MOD) % MOD * i % MOD)) % MOD;

	cout << static_cast<long long>(ans) * pow_mod(div, MOD - 2, MOD) % MOD << '\n';
	return 0;
}