import sys
hoge = input().split()
N = int(hoge[0])
M = int(hoge[1])
broken = []
for i in range(M):
  broken.append(int(input()))

anss = []
safes = []
fibo = [1,2]
safes.append(broken[0]-1)
for i in range(M-1):
  safes.append(broken[i+1] - broken[i] - 1)

safes.append(N-broken[M-1] - 1)

for i in range(len(safes)):
  if safes[i] == 0:
    anss.append(1) # 間が0
  elif safes[i] == 1:
    anss.append(1) # 間が1つ
  elif safes[i] == 2:
    anss.append(2) # 間が2つ
  else:
    for i in range(safes[i] - 2): # 間が3つ以上
      fibo.append(fibo[i] + fibo[i+1])
    anss.append(fibo.pop())
    fibo = [1, 2]

answer = 1
print(safes)
print(anss)
for i in range(len(anss)):
  answer = answer * anss[i]
# print(safes)
  
flag = 0
for i in range(M-1):
  if broken[i+1] - broken[i] == 1:
    flag = 1

if flag == 0:
  print(answer%1000000007)
else:
  print(0)