from math import factorial
import sys
N,M=map(int,input().split())
ANS1=1
ANS2=1
ANS3=1
A=int(input())
list1=[A]
DAN=A
B=DAN-DAN//2
for k in range(B):
  a = factorial(B) / factorial(k+1) / factorial(B - (k+1))
  ANS1+=a
for i in range(1,M):
  ans2=1
  A=int(input())
  list1+=[A]
  DAN=A-list1[i-1]-1
  B=DAN-DAN//2
  if A==list1[i-1] or A==list1[i-1]+1 and M!=1:
    print(0)
    sys.exit()
  for k in range(B):
    a = factorial(B) / factorial(k+1) / factorial(B - (k+1))
    ANS2+=a
  ANS3*=ANS2
DAN=N-A-1
B=DAN-DAN//2
for t in range(B):
  a = factorial(B) / factorial(t+1) / factorial(B - (t+1))
  ANS3+=a
ANS=ANS1*ANS2*ANS3  
print(int(ANS)%1000000007)