积性函数可以只求质数的函数值,
优化插值过程,维护前缀积后缀积
#include<bits/stdc++.h>
using namespace std;
#define rep( i, s, t ) for( register int i = s; i <= t; ++ i )
#define drep( i, s, t ) for( register int i = t; i >= s; -- i )
#define re register
#define int long long
#define LL long long
const int N = 1e7 + 5 ;
const int mod = 998244353 ;
int read() {
char cc = getchar(); int cn = 0, flus = 1;
while(cc < '0' || cc > '9') { if( cc == '-' ) flus = -flus; cc = getchar(); }
while(cc >= '0' && cc <= '9') cn = cn * 10 + cc - '0', cc = getchar();
return cn * flus;
}
int pr[N], sumf[2 * N], top ;
int n, b[N], pre[N], nxt[N], inv[N], K ;
bool isp[2 * N] ;
LL pow2( int x, int k ) {
LL ans = 1, base = x ;
while( k ) {
if( k & 1 ) ans *= base, ans %= mod ;
base *= base, base %= mod ;
k >>= 1 ;
}
return ans % mod ;
}
void init( int x ) {
sumf[1] = 1 ;
rep( i, 2, x ) {
if( !isp[i] ) pr[++ top] = i, sumf[i] = pow2( i, K );
for( re int j = 1; j <= top && i * pr[j] <= x; ++ j ) {
isp[i * pr[j]] = 1, sumf[i * pr[j]] = ( sumf[i] * sumf[pr[j]] ) % mod ;
if( i % pr[j] == 0 ) break;
}
}
rep( i, 2, x ) sumf[i] = sumf[i - 1] + sumf[i] ;
}
void lagr( int x ) {
b[1] = 0, nxt[0] = nxt[x + 1] = pre[x + 1] = pre[0] = inv[0] = 1; int Fac = 1 ;
rep( i, 2, x ) b[i] = ( b[i - 1] + sumf[2 * i - 1] - sumf[i] + mod ) % mod ;
rep( i, 1, x ) Fac = ( Fac * i ) % mod, pre[i] = ( n - i ) * pre[i - 1] % mod;
inv[x] = pow2( Fac, mod - 2 ) ;
drep( i, 1, x ) nxt[i] = ( nxt[i + 1] * ( n - i ) ) % mod, inv[i - 1] = ( inv[i] * i ) % mod ;
}
int get( int x ) {
int Ans = 0, d ;
rep( i, 1, x ) {
d = ( b[i] * pre[i - 1] ) % mod, d = ( d * nxt[i + 1] ) % mod;
d = ( d * ( ( inv[i - 1] * inv[x - i] ) % mod ) ) % mod ;
if( ( x - i ) % 2 ) d = mod - d ;
Ans = ( Ans + d ) % mod ;
}
return Ans % mod ;
}
signed main()
{
n = read(), K = read() ;
init( 2 * K + 6 ), lagr( K + 3 ) ;
int Kth = pow2( n, mod - 2 ) * 2 % mod ;
printf("%d\n", ( 1ll * get( K + 3 ) * Kth % mod ) ) ;
return 0;
}