Under construction

Still being built. Things may change

Good Set

Time limit1sMemory limit1024 MB

Summary
Count the nonempty subsets of {0, ..., 2^k - 1} that are closed under bitwise AND and OR and contain all given n integers, with k up to 7.
Level

Hard8 of 10

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

Problem

Seunghyun is a mathematician, and he likes good jokes.

For a set U={0,1,⋯ ,2k−1}U = \{0, 1, \cdots, 2^k - 1\}, a nonempty subset A⊂UA \subset U is good if it satisfies the following rules.

  • For any x,y∈Ax, y \in A, their bitwise AND x∧yx \land y is in AA.
  • For any x,y∈Ax, y \in A, their bitwise OR x∨yx \lor y is in AA.

You are given nn distinct integers in the range [0,2k−1][0, 2^k-1]. Find the number of good sets that contain all nn integers.

Input

The first line contains two integers kk and nn (1≤k≤71 \le k \le 7, 0≤n≤2k0 \le n \le 2^k).

The next line contains nn distinct integers a1,a2,⋯ ,ana_1, a_2, \cdots, a_n (0≤ai≤2k−10 \le a_i \le 2^k - 1).

Output

Print a single integer, the number of good sets.

Examples2

  1. Example 1

    Input
    2 1
    0
    
    Expected output
    7
    
  2. Example 2

    Input
    4 3
    1 2 7
    
    Expected output
    29