#include<bits/stdc++.h>
using namespace std;
const int mod=998244353;

typedef unsigned int uint;
typedef long long unsigned int uint64;


constexpr uint Max_size = 2000010, Mod = 998244353;

struct Z
{
    uint v;
    Z(const uint _v = 0) : v(_v) { }
};

inline Z operator+(const Z &x1, const Z &x2) { return x1.v + x2.v < Mod ? x1.v + x2.v : x1.v + x2.v - Mod; }
inline Z operator-(const Z &x1, const Z &x2) { return x1.v >= x2.v ? x1.v - x2.v : x1.v + Mod - x2.v; }
inline Z operator-(const Z &x) { return x.v ? Mod - x.v : 0; }
inline Z operator*(const Z &x1, const Z &x2) { return static_cast<uint64>(x1.v) * x2.v % Mod; }
inline Z &operator+=(Z &x1, const Z &x2) { x1.v = x1.v + x2.v < Mod ? x1.v + x2.v : x1.v + x2.v - Mod; return x1; }
inline Z &operator-=(Z &x1, const Z &x2) { x1.v = x1.v >= x2.v ? x1.v - x2.v : x1.v + Mod - x2.v; return x1; }
inline Z &operator*=(Z &x1, const Z &x2) { x1.v = static_cast<uint64>(x1.v) * x2.v % Mod; return x1; }
 
Z Power(Z Base, int Exp)
{
    Z res = 1;
    for (; Exp; Base *= Base, Exp >>= 1)
        if (Exp & 1)
            res *= Base;
    return res;
}

Z sqrt(const Z x)
{
    if (x.v == 0)
        return 0;
    Z w = 1;
    while (Power(w * w - x, (Mod - 1) / 2).v == 1)
        ++w.v;
    Z Base0 = w, Base1 = 1;
    w = w * w - x;
    Z res0 = 1, res1 = 0;
    int Exp = (Mod + 1) / 2;
    for (; Exp; std::tie(Base0, Base1) = std::make_tuple(Base0 * Base0 + Base1 * Base1 * w, 2 * Base0 * Base1), Exp >>= 1)
        if (Exp & 1)
            std::tie(res0, res1) = std::make_tuple(res0 * Base0 + res1 * Base1 * w, res0 * Base1 + Base0 * res1);
    return res0.v < Mod - res0.v ? res0 : Mod - res0;
}

int size;
int bitrev[Max_size];
Z w[Max_size];
Z Inv[Max_size];

inline void init(int n)
{
    for (size = 1; size < n; size <<= 1)
        ;
    for (int i = 0; i < size; ++i)
        bitrev[i] = bitrev[i >> 1] >> 1 | ((i & 1) * (size >> 1));
    Z pr = Power(3, (Mod - 1) / size);
    w[size / 2] = 1;
    for (int i = 1; i < size / 2; ++i)
        w[size / 2 + i] = w[size / 2 + i - 1] * pr;
    for (int i = size / 2 - 1; i; --i)
        w[i] = w[i << 1];
    Inv[1] = 1;
    for (int i = 2; i < size; ++i)
        Inv[i] = (Mod - Mod / i) * Inv[Mod % i];
}

inline void DFT(Z A[], int L)
{
    static uint64 t[Max_size];
    
    int shift = __builtin_ctz(size) - __builtin_ctz(L);
    for (int i = 0; i != L; ++i)
        t[bitrev[i] >> shift] = A[i].v;
    for (int d = 1; d != L; d <<= 1)
        for (int i = 0; i != L; i += d << 1)
            for (int j = 0; j != d; ++j)
            {
                uint64 tmp = t[i + d + j] * w[d + j].v % Mod;
                t[i + d + j] = t[i + j] + Mod - tmp, t[i + j] = t[i + j] + tmp;
            }
    for (int i = 0; i != L; ++i)
        A[i].v = t[i] % Mod;
}

inline void IDFT(Z A[], int L)
{
    std::reverse(A + 1, A + L);
    DFT(A, L);
    Z Inv_L = Power(L, Mod - 2);
    for (int i = 0; i != L; ++i)
        A[i] *= Inv_L;
}

void Rec(Z A[], Z res[], int L)
{
    Z B[Max_size], dfta[Max_size], dftb[Max_size];
    for (int i = 0; i != L; ++i)
        B[i] = dfta[i] = dftb[i] = 0;
    B[0] = Power(A[0], Mod - 2);
    for (int d = 1; d != L; d <<= 1)
    {
        for (int i = 0; i != d << 1; ++i)
            dfta[i] = A[i];
        for (int i = 0; i != d; ++i)
            dftb[i] = B[i];
        DFT(dfta, d << 1), DFT(dftb, d << 1);
        for (int i = 0; i != d << 1; ++i)
            dfta[i] *= dftb[i];
        IDFT(dfta, d << 1);
        for (int i = 0; i != d; ++i)
            dfta[i] = 0;
        DFT(dfta, d << 1);
        for (int i = 0; i != d << 1; ++i)
            dfta[i] *= dftb[i];
        IDFT(dfta, d << 1);
        for (int i = d; i != d << 1; ++i)
            B[i] = -dfta[i];
    }
    for (int i = 0; i != L; ++i)
        res[i] = B[i];
}

void Quo(Z A[], Z C[], Z res[], int L)
{
    if (L == 1)
    {
        res[0] = C[0] * Power(A[0], Mod - 2);
        return;
    }
    Z B[Max_size], dfta[Max_size], dftb[Max_size], dftc[Max_size];
    for (int i = 0; i != L; ++i)
        B[i] = dfta[i] = dftb[i] = dftc[i] = 0;
    Rec(A, B, L >> 1);
    for (int i = 0; i != L; ++i)
        dfta[i] = A[i];
    for (int i = 0; i != L >> 1; ++i)
        dftb[i] = B[i];
    DFT(dfta, L), DFT(dftb, L);
    for (int i = 0; i != L; ++i)
        dfta[i] *= dftb[i];
    IDFT(dfta, L);
    for (int i = 0; i != L >> 1; ++i)
        dfta[i] = 0;
    DFT(dfta, L);
    for (int i = 0; i != L >> 1; ++i)
        dftc[i] = C[i];
    DFT(dftc, L);
    for (int i = 0; i != L; ++i)
        dfta[i] *= dftc[i];
    IDFT(dfta, L);
    for (int i = 0; i != L; ++i)
        dftc[i] *= dftb[i];
    IDFT(dftc, L);
    for (int i = 0; i != L >> 1; ++i)
        dfta[i] = 0;
    for (int i = L >> 1; i != L; ++i)
        dfta[i] = C[i] - dfta[i];
    DFT(dfta, L);
    for (int i = 0; i != L; ++i)
        dfta[i] *= dftb[i];
    IDFT(dfta, L);
    for (int i = 0; i != L; ++i)
        res[i] = dftc[i];
    for (int i = L >> 1; i != L; ++i)
        res[i] += dfta[i];
}

void Sqrt(Z A[], Z res[], int L)
{
    static Z B[Max_size], C[Max_size], dftb[Max_size], dftc[Max_size], tmp[Max_size];
    for (int i = 0; i != L; ++i)
        B[i] = C[i] = dftb[i] = dftc[i] = tmp[i] = 0;
    B[0] = sqrt(A[0]), C[0] = Power(sqrt(A[0]), Mod - 2);
    dftb[0] = B[0];
    DFT(dftb, 1);
    for (int d = 1; d != L; d <<= 1)
    {
        for (int i = 0; i != d; ++i)
            dftb[i] *= dftb[i];
        IDFT(dftb, d);
        for (int i = 0; i != d; ++i)
            dftb[d + i] = dftb[i] - A[i] - A[d + i], dftb[i] = 0;
        DFT(dftb, d << 1);
        for (int i = 0; i != d << 1; ++i)
            dftc[i] = C[i];
        DFT(dftc, d << 1);
        
        for (int i = 0; i != d << 1; ++i)
            dftb[i] *= dftc[i];
        IDFT(dftb, d << 1);
        for (int i = d; i != d << 1; ++i)
            B[i] = dftb[i] * 499122176;
        
        if ((d << 1) != L)
        {
            for (int i = 0; i != d << 1; ++i)
                dftb[i] = B[i];
            DFT(dftb, d << 1);
            for (int i = 0; i != d << 1; ++i)
                tmp[i] = dftb[i] * dftc[i];
            IDFT(tmp, d << 1);
            for (int i = 0; i != d; ++i)
                tmp[i] = 0;
            DFT(tmp, d << 1);
            for (int i = 0; i != d << 1; ++i)
                tmp[i] *= dftc[i];
            IDFT(tmp, d << 1);
            for (int i = d; i != d << 1; ++i)
                C[i] = -tmp[i];
        }
    }
    for (int i = 0; i != L; ++i)
        res[i] = B[i];
}

void Der(Z A[], Z res[], int L)
{
    for (int i = 1; i != L; ++i)
        res[i - 1] = A[i] * i;
    res[L - 1] = 0;
}

void Int(Z A[], Z res[], int L)
{
    for (int i = L - 1; i; --i)
        res[i] = A[i - 1] * Inv[i];
    res[0] = 0;
}

void Log(Z A[], Z res[], int L)
{
    Z der[Max_size];
    Der(A, der, L);
    Quo(A, der, der, L);
    Int(der, res, L);
}

void Exp(Z A[], Z res[], int L)
{
    Z der[Max_size];
    Der(A, der, L);
    Z B[Max_size], C[Max_size], dfta[Max_size], dftb[Max_size], dftb2[Max_size], dftc[Max_size];
    for (int i = 0; i != L; ++i)
        B[i] = C[i] = dfta[i] = dftb[i] = dftb2[i] = dftc[i] = 0;
    B[0] = C[0] = 1;
    dftb2[0] = B[0];
    DFT(dftb2, 2);
    for (int d = 1; d != L; d <<= 1)
    {
        for (int i = 0; i != d; ++i)
            dftc[i] = C[i];
        DFT(dftc, d << 1);
        for (int i = 0; i != d; ++i)
            dftb[i] = dftb2[i << 1] * dftc[i << 1];
        IDFT(dftb, d);
        dftb[0] -= 1;
        for (int i = 0; i != d; ++i)
            dftb[d + i] = dftb[i], dftb[i] = 0; // g_0h_0-1
        DFT(dftb, d << 1); 
        for (int i = 0; i != d - 1; ++i)
            dfta[i] = der[i];
        dfta[d - 1] = 0;
        DFT(dfta, d << 1);
        for (int i = 0; i != d << 1; ++i)
            dfta[i] *= dftb[i];
        IDFT(dfta, d << 1); // (g_0h_0-1){f_0}'
        
        Der(B, dftb, d);
        DFT(dftb, d);
        for (int i = 0; i != d; ++i)
            dftb[i] *= dftc[i << 1];
        IDFT(dftb, d); // {g_0}'h_0
        
        for (int i = 0; i != d - 1; ++i)
            dftb[d + i] = dftb[i] - der[i], dftb[i] = 0;
        for (int i = d - 1; i != d << 1; ++i)
            dftb[i] -= der[i] + dfta[i];
        Int(dftb, dftb, d << 1);
        DFT(dftb, d << 1);
        for (int i = 0; i != d << 1; ++i)
            dftb[i] *= dftb2[i];
        IDFT(dftb, d << 1);
        for (int i = d; i != d << 1; ++i)
            B[i] = -dftb[i];
        
        if ((d << 1) != L)
        {
            for (int i = 0; i != d << 1; ++i)
                dftb2[i] = B[i];
            DFT(dftb2, d << 2);
            for (int i = 0; i != d << 1; ++i)
                dftb[i] = dftb2[i << 1];
            for (int i = 0; i != d << 1; ++i)
                dftb[i] *= dftc[i];
            IDFT(dftb, d << 1);
            for (int i = 0; i != d; ++i)
                dftb[i] = 0;
            DFT(dftb, d << 1);
            for (int i = 0; i != d << 1; ++i)
                dftb[i] *= dftc[i];
            IDFT(dftb, d << 1);
            for (int i = d; i != d << 1; ++i)
                C[i] = -dftb[i];
        }
    }
    for (int i = 0; i != L; ++i)
        res[i] = B[i];
}

void Rec_Sqrt(Z A[], Z res[], int L)
{
    Z B[Max_size], dfta[Max_size], dftb[Max_size];
    for (int i = 0; i != L; ++i)
        B[i] = dfta[i] = dftb[i] = 0;
    B[0] = Power(sqrt(A[0]), Mod - 2);
    for (int d = 1; d != L; d <<= 1)
    {
        for (int i = 0; i != d << 1; ++i)
            dfta[i] = A[i];
        for (int i = 0; i != d; ++i)
            dftb[i] = B[i];
        for (int i = d; i != d << 1; ++i)
            dftb[i] = 0;
        DFT(dfta, d << 2), DFT(dftb, d << 2);
        for (int i = 0; i != d << 2; ++i)
            dfta[i] *= dftb[i] * dftb[i] * dftb[i];
        IDFT(dfta, d << 2);
        for (int i = d; i != d << 1; ++i)
            B[i] = -dfta[i] * 499122177;
    }
    for (int i = 0; i != L; ++i)
        res[i] = B[i];
}

int N, L;
Z A[Max_size], tmp[Max_size];

/*int main(int argc, char **argv)
{
    IO >> N;
    for (int i = 0; i != N; ++i)
        IO >> A[i].v;
    
    for (L = 1; L < N; L <<= 1)
        ;
    init(L);
    
    Exp(A, A, L);
    
    for (int i = 0; i != N; ++i)
        IO << A[i].v << ' ';
    
    return 0;
	}*/

int qpow(int a,int b) {
	int ret=1;
	while(b) {
		if(b&1) ret=1ll*ret*a%mod;
		a=1ll*a*a%mod,b>>=1;
	}
	return ret;
}

int fac[500010];

int main() {
	int n,m;cin>>n>>m;
	fac[0]=1;for(int i=1;i<=m;i++) fac[i]=1ll*fac[i-1]*i%mod;
	for(int i=0;i<=m;i++) A[i].v=1ll*(m+1-i)*qpow(fac[i],mod-2)%mod*qpow(m+1,mod-2)%mod;
	int L=524288;
	init(L);
	Log(A,A,L);
	for(int i=0;i<L;i++) A[i].v=1ll*A[i].v*n%mod;
	Exp(A,A,L);
	int ans=0;
	for(int i=0;i<=m;i++) ans=(ans+1ll*A[i].v*qpow(fac[m-i],mod-2)%mod*qpow(m+1,n))%mod;
	cout<<1ll*ans*fac[m]%mod;
	/*int n=gi(),m=gi();
	fac[0]=1;for(int i=1;i<=m;i++) fac[i]=1ll*fac[i-1]*i%mod;
	vector<int> G(m+1);
	for(int i=0;i<=m;i++) G[i]=1ll*(m+1-i)*qpow(fac[i],mod-2)%mod;
	vector<int> F=pqpow(G,n,get2(m+1));
	int ans=0;
	for(int i=0;i<=m;i++) ans=(ans+1ll*F[i]*qpow(fac[m-i],mod-2))%mod;
	ans=1ll*ans*fac[m]%mod;
	cout<<ans;*/
    return 0;
}


Measured memory_bytes: 107776