Problem:
Score : 1100 points

Problem Statement

There are 2^N players, numbered 1, 2, ..., 2^N.
They decided to hold a tournament.

The tournament proceeds as follows:

Choose a permutation of 1, 2, ..., 2^N: p_1, p_2, ..., p_{2^N}.

The players stand in a row in the order of Player p_1, Player p_2, ..., Player p_{2^N}.

Repeat the following until there is only one player remaining in the row:

Play the following matches: the first player in the row versus the second player in the row, the third player versus the fourth player, and so on. The players who lose leave the row. The players who win stand in a row again, preserving the relative order of the players.

The last player who remains in the row is the champion.

It is known that, the result of the match between two players can be written as follows, using M integers A_1, A_2, ..., A_M given as input:

When y = A_i for some i, the winner of the match between Player 1 and Player y (2 \leq y \leq 2^N) will be Player y.

When y \neq A_i for every i, the winner of the match between Player 1 and Player y (2 \leq y \leq 2^N) will be Player 1.

When 2 \leq x < y \leq 2^N, the winner of the match between Player x and Player y will be Player x.

The champion of this tournament depends only on the permutation p_1, p_2, ..., p_{2^N} chosen at the beginning.
Find the number of permutation p_1, p_2, ..., p_{2^N} chosen at the beginning of the tournament that would result in Player 1 becoming the champion, modulo 10^9 + 7.

Constraints

1 \leq N \leq 16

0 \leq M \leq 16

2 \leq A_i \leq 2^N (1 \leq i \leq M)

A_i < A_{i + 1} (1 \leq i < M)

Input

Input is given from Standard Input in the following format:

N M
A_1 A_2 ... A_M

Output

Print the answer.

Sample Input 1

2 1
3

Sample Output 1

8

Examples of p that satisfy the condition are: [1, 4, 2, 3] and [3, 2, 1, 4]. Examples of p that do not satisfy the condition are: [1, 2, 3, 4] and [1, 3, 2, 4].

Sample Input 2

4 3
2 4 6

Sample Output 2

0

Sample Input 3

3 0

Sample Output 3

40320

Sample Input 4

3 3
3 4 7

Sample Output 4

2688

Sample Input 5

16 16
5489 5490 5491 5492 5493 5494 5495 5497 18993 18995 18997 18999 19000 19001 19002 19003

Sample Output 5

816646464

Solution in C++14 (GCC 5.4.1) (judge verdict: Accepted)

/*
考虑把竞赛树建出来。那么合法的充要条件是：对于从1到根每个分叉出去的子树，子树中（叶子节点）最小值不在A中
计数考虑容斥，钦定一些A中的元素不合法。设这些元素大到小排序后为a1, a2, ..., an，ai占用的子树大小为S(ai)，那么这时候的方案数就是按照这个顺序算个组合数乘起来
那么状压dp容斥过程，设F(i, S)表示考虑到了Ai，当前用了S集合中的子树大小
*/

#include <cstdio>
#include <cstring>

using namespace std;
const int Max_N(16);
const int MOD(1000000000 + 7);
typedef long long int LL;

constexpr int Mult(int a, int b)
{
	return a * 1LL * b % MOD;
}

constexpr int Add(int a, int b)
{
	return a + b >= MOD ? a + b - MOD : a + b;
}

constexpr int Sub(int a, int b)
{
	return a - b < 0 ? a - b + MOD : a - b;
}

void exgcd(int a, int b, int &x, int &y)
{
	if (b == 0)
		x = 1, y = 0;
	else
		exgcd(b, a % b, y, x), y -= x * (a / b);
}

inline int inverse(int a)
{
	int invx, invy;
	exgcd(a, MOD, invx, invy);
	return (invx % MOD + MOD) % MOD;
}

int N, M, A[Max_N + 5], Fac[(1 << Max_N) + 5], Inv[(1 << Max_N) + 5], F[2][1 << Max_N];

inline int P(int n, int m)
{
	return 0 <= m && m <= n ? Mult(Fac[n], Inv[n - m]) : 0;
}

int main()
{
	scanf("%d%d", &N, &M);
	for (int i = 1;i <= M;++i)
		scanf("%d", A + (M - i + 1));
	Fac[0] = 1;
	for (int i = 1;i <= (1 << N);++i)
		Fac[i] = Mult(Fac[i - 1], i);
	Inv[1 << N] = inverse(Fac[1 << N]);
	for (int i = (1 << N) - 1;i >= 0;--i)
		Inv[i] = Mult(Inv[i + 1], i + 1);
	F[0][0] = 1;
	for (int i = 1, now = 0, lst = 1;i <= M;++i)
	{
		now ^= 1, lst ^= 1, memset(F[now], 0, sizeof(F[now]));
		for (int S = 0, SumS;S < (1 << N);++S)
		{
			if (!F[lst][S])
				continue;
			F[now][S] = Add(F[now][S], F[lst][S]);
			SumS = 0;
			for (int j = 0;j <= N - 1;++j)
				if (S & (1 << j))
					SumS += (1 << j);
			for (int j = 0;j <= N - 1;++j)
				if ((S & (1 << j)) == 0)
					F[now][S | (1 << j)] = Sub(F[now][S | (1 << j)], Mult(F[lst][S], Mult(1 << j, P((1 << N) - A[i] - SumS, (1 << j) - 1))));
		}
	}
	int Ans(0);
	for (int S = 0, SumS;S < (1 << N);++S)
	{
		SumS = 0;
		for (int i = 0;i <= N - 1;++i)
			if (S & (1 << i))
				SumS += (1 << i);
		Ans = Add(Ans, Mult(F[(M & 1)][S], Mult(1 << N, Fac[(1 << N) - SumS - 1])));
	}
	printf("%d", Ans);
	return 0;
}