#include #include #include using namespace std; const int MOD = 998244353; struct mint { int val; mint() : val(0) {} mint(long long v) { if (abs(v) >= MOD) { v %= MOD; } if (v < 0) { v += MOD; } val = v; } mint &operator++() { val++; if (val == MOD) { val = 0; } return *this; } mint &operator--() { if (val == 0) { val = MOD; } val--; return *this; } mint &operator+=(const mint &x) { val += x.val; if (val >= MOD) { val -= MOD; } return *this; } mint &operator-=(const mint &x) { val -= x.val; if (val < 0) { val += MOD; } return *this; } mint &operator*=(const mint &x) { val = (int)((long long)val * x.val % MOD); return *this; } mint &operator/=(const mint &x) { *this *= x.inv(); return *this; } mint operator-() { return mint() - *this; } mint pow(long long n) const { mint x = 1, r = *this; while (n) { if (n & 1) { x *= r; } r *= r; n >>= 1; } return x; } mint inv() const { return pow(MOD - 2); } friend mint operator+(const mint &x, const mint &y) { return mint(x) += y; } friend mint operator-(const mint &x, const mint &y) { return mint(x) -= y; } friend mint operator*(const mint &x, const mint &y) { return mint(x) *= y; } friend mint operator/(const mint &x, const mint &y) { return mint(x) /= y; } friend bool operator==(const mint &x, const mint &y) { return x.val == y.val; } friend bool operator!=(const mint &x, const mint &y) { return x.val != y.val; } friend std::ostream &operator<<(std::ostream &os, const mint &x) { return os << x.val; } friend std::istream &operator>>(std::istream &is, mint &x) { long long v; is >> v; x = mint(v); return is; } }; mint modpow(mint x, long long n) { mint res = 1, r = x; while (n) { if (n & 1) { res *= r; } r *= r; n >>= 1; } return res; } struct combination { int maxn; std::vector fact; std::vector ifact; combination(int maxn) : maxn(maxn) { fact.resize(maxn + 1); ifact.resize(maxn + 1); fact[0] = 1; for (int i = 1; i <= maxn; i++) { fact[i] = fact[i - 1] * i; } ifact[maxn] = modpow(fact[maxn], MOD - 2); for (int i = maxn - 1; i >= 0; i--) { ifact[i] = ifact[i + 1] * (i + 1); } } mint operator()(int n, int k) { assert(n <= maxn); if (k > n || k < 0) { return 0; } return fact[n] * ifact[k] * ifact[n - k]; } }; int main() { int n, k; cin >> n >> k; combination com(n - 1); mint ans = 0; for (int i = 0; i < n; i++) { ans += com(n - 1, i) * modpow(i, k); } cout << ans << endl; }