/*
3 2
Ev = sum(value of outcome i/possibility of outcome i) for all i
Ev of city number i = sum((value of city i*p(i))/2^k) where p(i) is the probability of choosing city i as the median, all p(i) sum to one!
Because the probability distributions summing to 1 are symmetrical, the result is the center.
*/
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define vi vector<int>
#define vl vector<ll>
#define vii vector<vector<int>>
#define vll vector<vector<ll>>
#define pii pair<int, int>
#define pil pair<int, ll>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
template<typename T>
using ordered_set = tree<T, null_type, less<T>,
rb_tree_tag, tree_order_statistics_node_update>;
//ordered_set<int> st; ordered set
//gp_hash_table<int, int> table; faster hash table
const ll mod = 998244353LL;
const int maxn = 1000001;
vl facts(maxn, 1LL);
ll pw(ll a, ll b){ //a^b
if(b == 0) return 1LL;
ll half = pow(a, b/2);
if(b%2 == 0) return (half*half)%mod;
return (((half*half)%mod)*a)%mod;
}
ll dvd(ll a, ll b){
return (a*pow(b, mod-2LL))%mod;
}
ll choose(int a, int b){ //a choose b, a!/(b!*(a-b)!), const factor of ~30 so use wisely
if(b > a) return 0LL;
ll num = facts[a];
ll den = (facts[b] * facts[a-b])%mod;
return dvd(num, den);
}
ll n; ll k; //n cities, k friends
//all friends meet at the median
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
for(int a = 1; a < maxn; a++) facts[a] = (facts[a-1]*(ll)a)%mod;
cin >> n >> k;
if(k%2 == 0){ //given that there is an even number of friends, the floor between the two edge friends becomes the median -->
//subtract expected shift left distance - ((n+1)*n^k - e(d))/2
//how much does road i...i+1 contribute to the answer?
ll sm = 0LL; ll k2 = k/2LL;
for(int i = 1; i < n; i++){
//k/2 to the left, k/2 to the right, 3rd city left 4th city right
ll e = (choose(k, k2) * pw(i, k2))%mod;
e = (e * pw(n-i, k2))%mod;
sm = (sm + e)%mod;
}
ll rt = ((n+1LL)*pw(n, k))%mod;
cout << dvd((rt-sm+mod)%mod, 2LL);
}
else{ //given median at whole number position i, floor(k/2) friends meet at either end OR live at position i along with the middle friend --> all arrangements are unique to the i (a single arrangement cannot represent two different medians)
cout << (dvd(n+1LL, 2LL) * pw(n, k))%mod << "\n";
}
}