#include using namespace std; #ifdef LOCAL #include "settings/debug.cpp" #define _GLIBCXX_DEBUG #else #define Debug(...) void(0) #endif using ll = long long; #define rep(i, n) for (int i = 0; i < (n); ++i) #include using mint = atcoder::modint998244353; int main() { int n, k; cin >> n >> k; mint ans = mint(k) * mint(k - 1) * mint(n) / mint(k).pow(n); cout << ans.val() << endl; return 0; }