import math
from fractions import Fraction
import sys
sys.setrecursionlimit(15000)

def fibMul(fn1, fn2):
  a = fn1[0]
  b = fn1[1]
  c = fn2[0]
  d = fn2[1]
  return (a*c + 5*b*d, a*d + b*c)

def fibExp(fn, n):
  if (n == 0):
    return (Fraction(1), Fraction(1));
  if (n % 2 == 0):
    return fibExp(fibMul(fn, fn), n / 2);
  return fibMul(fn, fibExp(fn, n - 1));

def fibMin(fn1, fn2):
  a = fn1[0]
  b = fn1[1]
  c = fn2[0]
  d = fn2[1]
  return (a - c, b - d)

def fibMain(n):
  fibNum1 = (Fraction(1, 2), Fraction( 1, 2))
  fibNum2 = (Fraction(1, 2), Fraction(-1, 2))

  fibNum3 = fibMin(fibExp(fibNum1, n), fibExp(fibNum2, n))
  fibNum4 = (Fraction(0, 1), Fraction(1, 5))
  return fibMul(fibNum3, fibNum4)

def fib(n):
  return fibMain(n)[0].numerator
"""def fib(n):
    f = (((1 + math.sqrt(5)) / 2)**n - ((1 - math.sqrt(5)) / 2)**n ) / math.sqrt(5)
    return int(f)"""


NM = [int(i) for i in input().split()]
a = []
b = []
answer = 0
flag = True
for i in range(NM[1]):
    a.append(int(input()))
    if(i == 0):
        if(a[i] - 1 != 0):
            b.append(a[i] - 1)
        if(a[i] - 1 < 0):
            flag = False
    else:
        if(a[i] - a[i - 1] - 2 != 0):
            b.append(a[i] - a[i - 1] - 2)
        if(a[i] - a[i - 1] - 2 < 0):
            flag = False

    if(i == NM[1] - 1):
        if(NM[0] - a[i] - 1 != 0):
            b.append(NM[0] - a[i] - 1)
        if(NM[0] - a[i] - 1 < 0):
            flag = False

if(NM[1] > NM[0]/2):
    answer = 0
elif(not flag):
    answer = 0
else:
    sum = 1
    for i in range(len(b)):
        sum *= fib(b[i] + 1)
        sum = sum % (10**9 + 7)
    answer = sum
print(answer)
