local mmi, mma = math.min, math.max local bls, brs = bit.lshift, bit.rshift local bxor = bit.bxor local mod = 998244353 local mfl = math.floor local function bmul(x, y) local x0, y0 = x % 31596, y % 31596 local x1, y1 = mfl(x / 31596), mfl(y / 31596) return (x1 * y1 * 62863 + (x1 * y0 + x0 * y1) * 31596 + x0 * y0) % mod end local function badd(x, y) return (x + y) % mod end local n, k = io.read("*n", "*n") local a = {} for i = 1, n do a[i] = io.read("*n") end if 10 < k then print(0) os.exit() end local tot = bls(1, 10) local alltask = {} local stagetask = {} for i = 1, 10 do stagetask[i] = {} end for i = 1, tot - 1 do alltask[i] = {} for j = 1, k do alltask[i][j] = 0 end end for i = 1, tot - 1 do local ti = i local cnt = 0 for j = 1, 10 do if ti % 2 == 1 then cnt = cnt + 1 end ti = brs(ti, 1) end table.insert(stagetask[cnt], i) end for i = 1, n do alltask[a[i]][1] = alltask[a[i]][1] + 1 end local function grayCode(x) return bxor(x, brs(x, 1)) end local g_dst = 0 local g_box = {} local g_src = 0 local function add_func(idx) g_src = g_src + bls(1, g_box[idx] - 1) end local function rm_func(idx) g_src = g_src - bls(1, g_box[idx] - 1) end local function work_func() if g_src * 2 < g_dst then local lim = mmi(k, #g_box) local at1 = alltask[g_src] local at2 = alltask[g_dst - g_src] local atd = alltask[g_dst] for i = 2, lim do local v = 0 for j = 1, i - 1 do v = badd(v, bmul(at1[j], at2[i - j])) end atd[i] = badd(atd[i], v) end end end local bpos = {} for i = 1, 10 do bpos[bls(1, i - 1)] = i end local function grayWalk(size) local prv = 0 local total = bls(1, size) - 1 -- work_func() for i = 1, total do local v = grayCode(i) if prv < v then prv, v = v, v - prv add_func(bpos[v]) else prv, v = v, prv - v rm_func(bpos[v]) end work_func() end end for stage = 2, 10 do local stlen = #stagetask[stage] for i_stagetask = 1, stlen do local tmp = stagetask[stage][i_stagetask] g_dst = tmp g_src = 0 local c = 0 for j = 1, 10 do if tmp % 2 == 1 then c = c + 1 g_box[c] = j end tmp = brs(tmp, 1) end grayWalk(stage) end end local ret = 0 for i = 1, 1023 do ret = badd(ret, alltask[i][k]) end print(ret)