import sys
input = sys.stdin.readline
'''
allinputs = iter(input().splitlines())
input = lambda : next(allinputs)
#'''

mod = 10 ** 9 + 7
N, M = map(int, input().split())
a = [0] * M

for i in range(M):
	a[i] = int(input())

now = 0
ans = 1
flag = 0

for i in range(M):
	if now == a[i]:
		flag = 1
		break
	
	next = a[i] - now - 1
	if next % 2 == 0:
		ans = (ans * 2 ** -(-next // 2)) % mod
	else:
		ans = (ans * (2 ** -(-next // 2)) - 1) % mod
	now = a[i] + 1

if flag == 1:
	print(0)
else:
	next = N - now
	if next % 2 == 0:
		ans = (ans * 2 ** -(-next // 2)) % mod
	else:
		ans = (ans * (2 ** -(-next // 2)) - 1) % mod
	print(ans)
