import math
N,M=map(int,input().split())

a1=int(input())
a2=a1
data=[a1]
ans_data=[]
for i in range(M-1):
  a1=a2
  a2=int(input())
  #print("a",a2-a1-1)
  data.append(a2-a1-1)
  
data.append(N-a2-1)
  
data=sorted(data)
#print(data)
if  data[0]==0:
  print(0)
  
elif data[M]==1:
  print(1)
else:
  mm=data.count(1)
  ma=2
  #print("mm=",mm)
  f1=1
  f2=2
  for i in range(0,data[M]+len(data)-2-mm):  
      
    if ma==data[mm]:
      ans_data.append(f2)
      #print("data[mm]",data[mm],"f2",f2,"i",i)
      mm=mm+1
     
    else:
      ma=ma+1
      f11=f1
      f1=f2
      f2=f1+f11
      #print("data[mm]",data[mm],"f2",f2,"ma",ma)
        
        
  ans=1
  #print("ans_data",ans_data)
  for i in range(0,len(ans_data)):
    ans=ans*ans_data[i]
    
  mod=10**9+7
  print(ans%mod)
    
    
    
    