// #define _GLIBCXX_DEBUG // for STL debug (optional)
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>
using namespace std;
using ll = long long int;
using int64 = long long int;
 
template<typename T> void chmax(T &a, T b) {a = max(a, b);}
template<typename T> void chmin(T &a, T b) {a = min(a, b);}
template<typename T> void chadd(T &a, T b) {a = a + b;}
 
int dx[] = {0, 0, 1, -1};
int dy[] = {1, -1, 0, 0};
const int INF = 1LL << 29;
const ll LONGINF = 1LL << 60;
const ll MOD = 998244353LL;

// ModInt begin

using ll = long long;
template<ll mod>
struct ModInt {
    ll v;
    ll mod_pow(ll x, ll n) const {
        return (!n) ? 1 : (mod_pow((x*x)%mod,n/2) * ((n&1)?x:1)) % mod;
    }
    ModInt(ll a = 0) : v((a %= mod) < 0 ? a + mod : a) {}
    ModInt operator+ ( const ModInt& b ) const {
        return (v + b.v >= mod ? ModInt(v + b.v - mod) : ModInt(v + b.v));
    }
    ModInt operator- () const {
        return ModInt(-v);
    }
    ModInt operator- ( const ModInt& b ) const {
        return (v - b.v < 0 ? ModInt(v - b.v + mod) : ModInt(v - b.v));
    }
    ModInt operator* ( const ModInt& b ) const {return (v * b.v) % mod;}
    ModInt operator/ ( const ModInt& b ) const {return (v * mod_pow(b.v, mod-2)) % mod;}
    
    bool operator== ( const ModInt &b ) const {return v == b.v;}
    bool operator!= ( const ModInt &b ) const {return !(*this == b); }
    ModInt& operator+= ( const ModInt &b ) {
        v += b.v;
        if(v >= mod) v -= mod;
        return *this;
    }
    ModInt& operator-= ( const ModInt &b ) {
        v -= b.v;
        if(v < 0) v += mod;
        return *this;
    }
    ModInt& operator*= ( const ModInt &b ) {
        (v *= b.v) %= mod;
        return *this;
    }
    ModInt& operator/= ( const ModInt &b ) {
        (v *= mod_pow(b.v, mod-2)) %= mod;
        return *this;
    }
    ModInt pow(ll x) { return ModInt(mod_pow(v, x)); }
    // operator int() const { return int(v); }
    // operator long long int() const { return v; }
};

template<ll mod>
ModInt<mod> pow(ModInt<mod> n, ll k) {
    return ModInt<mod>(n.mod_pow(n.v, k));
}

template<ll mod>
ostream& operator<< (ostream& out, ModInt<mod> a) {return out << a.v;}
template<ll mod>
istream& operator>> (istream& in, ModInt<mod>& a) {
    in >> a.v;
    return in;
}

// ModInt end

using mint = ModInt<MOD>;
mint dp[3][512][512][2];

int main() {
    int N, X; cin >> N >> X;
    vector<int> E, iE(N+1), O, iO(N+1);
    E.emplace_back(-1);
    for(int i=0; i<=N; i+=2) {
        iE[i] = E.size();
        E.emplace_back(i);
    }
    O.emplace_back(-1);
    for(int i=1; i<=N; i+=2) {
        iO[i] = O.size();
        O.emplace_back(i);
    }
    
    {
        int idx = iE[0];
        for(int k=idx; k<iE.size(); k++) dp[0][0][k][0] = mint(1);
    }
    
    for(int i=0; i<=X; i++) {
        int cur = i%2, nxt = cur^1;
        for(int x=0; x<512; x++) {
            for(int y=0; y<=N; y++) {
                auto &p0 = (y % 2 ? iO : iE);
                auto &p1 = (y % 2 ? iE : iO);
                // 累積和
                {
                    int k = p0[y], p = y%2;
                    dp[nxt][x][k][p] += dp[nxt][x][k-1][p];
                }
                
                // 偶数個 (y-0, y-2, y-4, ...)
                {
                    int k = p0[y];
                    int m = y % 2 ? 1 : 0;
                    int r = k, l = p0[m] - 1;

                    int p = y%2, np = p^1;
                    mint add = dp[cur][x][r][p] - dp[cur][x][l][p];

/*
                    if(add.v > 0) {
                        fprintf(stderr, "add (%d, %d, %d, k = %d): %lld\n", i, x, y, k, add.v);
                    }
*/
                    dp[nxt][x][k][p] += add;
                }
                
                // 奇数個 (y-1, y-3, y-5, ...)
                if(y >= 1) {
                    int v = x ^ i;
                    
                    int k = p0[y];
                    int m = y % 2 ? 0 : 1;
                    int r = p1[y-1], l = p1[m] - 1;

                    int p = y%2, np = p^1;
                    dp[nxt][x][k][p] += dp[cur][v][r][np] - dp[cur][v][l][np];
                }
            }
        }
        fill(dp[cur][0][0], dp[cur+1][0][0], mint(0));
    }

    int p = (X+1)%2;
    int SE = E.size() - 1, SO = O.size() - 1;

    const auto &pari = (N % 2 ? iO : iE);
    mint v1 = dp[p][X][ pari[N] - 0 ][N%2];
    mint v2 = dp[p][X][ pari[N] - 1 ][N%2];
    // fprintf(stderr, "%lld %lld\n", v1.v, v2.v);
    mint ans = v1 - v2;
    cout << ans << endl;
    return 0;
}



Measured memory_bytes: 15468