local mod = 1000000007 local mfl = math.floor local function bmul(x, y) local x1, y1 = mfl(x / 31623), mfl(y / 31623) local x0, y0 = x - x1 * 31623, y - y1 * 31623 return (x1 * y1 * 14122 + (x1 * y0 + x0 * y1) * 31623 + x0 * y0) % mod end local ffi = require("ffi") local C = ffi.C ffi.cdef[[ long long atoll(const char*); ]] local function lltonumber(str) return C.atoll(str) end local n, k = io.read("*n", "*n", "*l") if k == 0 then local v = 1 for i = 2, n do v = bmul(v, i) end print(v) os.exit() end local max = 0LL do local mul = 1LL for i = 1, n do max = max + mul mul = mul + mul end end local s = io.read() local a = {} local cmap = {} for w in s:gmatch("%d+") do local z = lltonumber(w) local tz = z local pop = 0 while 0LL < tz do if tz % 2LL == 1LL then pop = pop + 1 end tz = tz / 2LL end if cmap[pop] then print(0) os.exit() end cmap[pop] = true if 0LL < z and z < max then table.insert(a, {z, pop}) end end if #a == 0 then local v = 1 for i = 2, n do v = bmul(v, i) end print(v) os.exit() end table.sort(a, function(x, y) return x[2] < y[2] end) local ret = 1 do local c = a[1][2] for i = 2, c do ret = bmul(ret, i) end end do local c = a[#a][2] for i = 2, n - c do ret = bmul(ret, i) end end for i = 1, #a - 1 do local len = a[i + 1][2] - a[i][2] for i = 2, len do ret = bmul(ret, i) end local ta, tb = a[i][1], a[i + 1][1] for j = 0, 70 do if ta % 2 == 1 and tb % 2 == 0 then print(0) os.exit() end ta = ta / 2LL tb = tb / 2LL end end print(ret)