#pragma GCC optimize("O3") #include using namespace std; constexpr int md = 998244353; int main() { int N, K; cin >> N >> K; // Outer isomorphism of S6 // https://en.wikipedia.org/wiki/Automorphisms_of_the_symmetric_and_alternating_groups int ret = K; for (int i = 1; i <= N - K; ++i) ret = (long long)ret * i % md; if (N == 2) { ret = 1; } else if (N == 6) { if (K == 2) ret = (long long)ret * 4 % md; if (K == 3) ret = (long long)ret * 3 % md; if (K == 4) ret = (long long)ret * 2 % md; if (K == 5) ret = (long long)ret * 2 % md; if (K == 6) ret = (long long)ret * 1 % md; } cout << ret << '\n'; }