Ignore Submasks

Time limit1sMemory limit512 MB

Summary
For each k-bit mask x, find the first array element that does not contain x as a submask, and sum these indices modulo 998244353.
Level

Hard8 of 10

Topics
Bit manipulation, Dynamic programming, Combinatorics, Math
Solved
No attempts yet

Problem

You are given an array of nn integers, a1,a2,…,ana_1, a_2, \ldots, a_n. Each integer is between 0 and 2k−12^k - 1, inclusive.

Let f(x)f(x) be the smallest ii such that (ai&x)≠ai(a_i \& x) \neq a_i, or 0 if there is no such ii. Here (a&b)(a \& b) is the bitwise AND operation.

Find f(0)+f(1)+…+f(2k−1)f(0) + f(1) + \ldots + f(2^k - 1). This value may be very large, so find it modulo 998 244 353998\,244\,353.

Input

The first line contains two integers nn, kk (1≤n≤1001 \le n \le 100, 1≤k≤601 \le k \le 60).

The next line contains nn integers a1,a2,…,ana_1, a_2, \ldots, a_n (0≤ai<2k0 \le a_i < 2^k).

Output

Print f(0)+f(1)+…+f(2k−1)f(0) + f(1) + \ldots + f(2^k - 1) modulo 998 244 353998\,244\,353.

Notes

In the first example, f(0)=2f(0) = 2 and f(1)=0f(1) = 0.

In the second example, f(0)=1f(0) = 1, f(1)=1f(1) = 1, f(2)=2f(2) = 2, and f(3)=0f(3) = 0.

Examples3

  1. Example 1

    Input
    2 1
    0 1
    
    Expected output
    2
    
  2. Example 2

    Input
    2 2
    2 1
    
    Expected output
    4
    
  3. Example 3

    Input
    5 10
    389 144 883 761 556
    
    Expected output
    1118