N,M = map(int, input().split()) mod = 998244353 BITN = format(N,'b') bitnlen = len(BITN) if M>=len(BITN): HIGH = [] temp = 0 for b in BITN: temp^=int(b) HIGH.append(temp) LOWr = [] temp = 0 for b in BITN[::-1]: temp^=int(b) LOWr.append(temp) ans = 0 for i in range(bitnlen): ans += LOWr[i]*pow(2,i,mod) for i in range(bitnlen): ans += HIGH[i]*pow(2,bitnlen+M-2-i,mod) if BITN.count('1')%2==1: ans += pow(2,M-1,mod)-pow(2,bitnlen,mod) else: ans = 0 for i in range(M): ans^=N*pow(2,i) print(ans%mod)