import sys input = lambda :sys.stdin.readline()[:-1] ni = lambda :int(input()) na = lambda :list(map(int,input().split())) yes = lambda :print("yes");Yes = lambda :print("Yes");YES = lambda : print("YES") no = lambda :print("no");No = lambda :print("No");NO = lambda : print("NO") ####################################################################### def f(x): r = 0 while x > 0: r ^= x%2 x //= 2 return r n, m = na() mod = 998244353 d = 30 if m < d: ans = 0 for i in range(m): ans ^= n << i print(ans%mod) else: ans = 0 for i in range(d): ans ^= n<>d z = f(n) ans = a + b * pow(2, m, mod) + z * pow(2,d)*(pow(2,m-d,mod)-1) print(ans%mod)