#!/usr/bin/env python
import math
from operator import mul
from functools import reduce

def cmb(n,r):
	r = min(n-r,r)
	if r == 0: return 1
	over = reduce(mul, range(n, n - r, -1))
	under = reduce(mul, range(1,r + 1))
	return over // under

def get_num(k):
	num = 0
	if k > 2:
		for idx in range(math.ceil(k/2)):
			num = num + cmb(k-1-idx,idx)
	else:
		num = 1
	return num
	

line1 = [int(i) for i in input().split()]
N = line1[0]
M = line1[1]
As = []
ans = 1

for idx in range(M):
	As.append(int(input()))
	
if As[0] > 1:
	ans = get_num(As[0]-1)
	if As[0] > 2:
		ans = ans + get_num(As[0]-2)


for idx in range(0,M):
	if idx < M-1:
		dif = As[idx+1] - As[idx] - 1
	else:
		dif = N - As[idx]
	if dif == 1 and idx < M-1:
		ans = 0
		break
	else:
		ans = ans * get_num(dif)
	
print(ans%1000000007)