CodeEff/ECCO huggingface dataset:
# Original solution
N,M=list(map(int,input().split()))
a=[int(eval(input())) for _ in range(M)]
dp=[1]*(N+1)
if 1 in a:
  dp[1]=0
else:
  dp[1]=1
for i in range(2,N+1):
  if i in a:
    dp[i]=0
  else:
    dp[i]=dp[i-1]+dp[i-2]
  dp[i]%=1000000007
print((dp[N]))




# Optimized solution
N,M=list(map(int,input().split()))
dp=[1]*(N+1)
for _ in range(M):
  i=int(eval(input()))
  dp[i]=0
for i in range(2,N+1):
  if dp[i]!=0:
      dp[i]=dp[i-1]+dp[i-2]
  dp[i]%=1000000007
print((dp[N]))
# Original solution
MOD = 10**9 + 7
N,M = list(map(int,input().split(' ')))
broken_list = [int(eval(input())) for i in range(M)]

ans = [0,1]

for n in range(1,N+1):
  if n in broken_list:
    ans.append(0)
  else:
    ans.append((ans[-2]+ans[-1]) % MOD)

print((ans[-1] % MOD))               

# Optimized solution
MOD = 10**9 + 7
N,M = list(map(int,input().split(' ')))
broken_list = set([int(eval(input())) for i in range(M)])

ans = [0,1]

for n in range(1,N+1):
  if n in broken_list:
    ans.append(0)
  else:
    ans.append((ans[-2]+ans[-1]) % MOD)

print((ans[-1] % MOD))
# Original solution
import sys
sys.setrecursionlimit(10**7)
def lmi(): return list(map(int, input().split()))

n, m = lmi()
a = [int(eval(input())) for i in range(m)]

l = [0] * (n+1)
l[0] = 1
h = list(range(n+1))
for i in a:
    h.remove(i)
for i in h:
     if i == 1:
        l[i] = 1
     elif i >= 2:
        l[i] = l[i-1] + l[i-2]
        l[i] %= 1000000007


#print(l)
print((l[n] % 1000000007))


# Optimized solution
import sys
sys.setrecursionlimit(10**7)
def lmi(): return list(map(int, input().split()))

n, m = lmi()

l = [0] * (n+1)
l[0] = 1

a = 0
if m != 0:
    a = int(eval(input()))
k = 1
for i in range(n+1):

    if i != a:
        if i == 1:
            l[i] = 1
        elif i >= 2:
            l[i] = l[i-1] + l[i-2]
            l[i] %= 1000000007
    else:
        k += 1
        if k <= m:
            a = int(eval(input()))



#print(l)
print((l[n] % 1000000007))
# Original solution
import sys
sys.setrecursionlimit(10**7)
def lmi(): return list(map(int, input().split()))

n, m = lmi()

l = [0] * (n+1)
l[0] = 1

a = 0
if m != 0:
    a = int(eval(input()))
k = 1
for i in range(n+1):

    if i != a:
        if i == 1:
            l[i] = 1
        elif i >= 2:
            l[i] = l[i-1] + l[i-2]
            l[i] %= 1000000007
    else:
        k += 1
        if k <= m:
            a = int(eval(input()))



#print(l)
print((l[n] % 1000000007))


# Optimized solution
import sys
sys.setrecursionlimit(10**7)
def lmi(): return list(map(int, input().split()))

n, m = lmi()
a = [1] * (n+1)
for i in range(m):
    a[int(eval(input()))] = 0
k = [0] * (n+1)
k[0] = 1
for i in range(1,n+1):
    if i == 1 and a[1]:
        k[1] = 1
    elif i >= 2 and a[i]:
        k[i] = k[i-1] + k[i-2]
        k[i] %= 10 ** 9 + 7

print((k[n]))
# Original solution
import math
def cmb(n, r):
    return math.factorial(n)// ( math.factorial(n-r) * math.factorial(r) )



N,M = input().split()

N = int(N)
M = int(M)

a = []
ans = 1

for i in range(M):
    newa = int(eval(input()))
    a.append(newa)

if (M != 0):
    for k in range(M-1):
        if (a[k+1] - a[k] == 1):
            ans = 0
            
    
    
    for i in range(M + 1):
    

        if (i == 0):
            dan = a[i] - 1
        elif (i == M):
            dan = N - a[i - 1] - 1
        else:
            dan = a[i] - a[i - 1] - 2

        abletwo = (dan - (dan % 2)) // 2
        now = 0

        if (dan != 0):

            for j in range(abletwo + 1):

                now += cmb (dan - j , j )

        else:
            now = 1
        
        ans *= now

else:
    ans = 0
    abletwo = (N - (N % 2)) // 2

    for j in range(abletwo + 1):

        ans += cmb (N - j , j )

ans = ans % 1000000007
print (ans)


# Optimized solution

N, M = input().split()

N = int(N)
M = int(M)
a = []
c = []

for i in range(M):

    anew = int(eval(input()))
    a.append(anew)

now_a = 0
a.append(-1)
ans = 0

for i in range( N + 1 ):

    if (i == 0):
        c.append(1)
        
    elif (i == 1):

        if (a[now_a] == i):
            c.append(0)
            now_a += 1
        else:
            c.append(1)

    else:

        if (a[now_a] == i):
            c.append(0)
            now_a += 1
        else:
            c.append( c[i - 1] + c[i - 2])
        

ans = c[N] % 1000000007

print (ans)
# Original solution
N,M=list(map(int,input().split()))
A=[int(eval(input())) for i in range(M)]
m=10**9+7
b=0
ans=[0,1]
for i in range(1,N+1):
    if (i in A) and (i+1 in A):
        print((0))
        exit()
    if i in A:
        ans.append(0)
    else:
        ans.append(ans[-1]+ans[-2])

print((ans[-1] % m))

# Optimized solution
N,M=list(map(int,input().split()))
N=list(range(1,N+1))
for i in range(M):
    N[int(eval(input()))-1]=0
m=10**9+7
ans=[0,1]
for i in N:
    if i==0 and i+1==0:
        print((0))
        exit()
    if i==0:
        ans.append(0)
    else:
        ans.append(ans[-1]+ans[-2])

print((ans[-1] % m))
# Original solution
n,m = list(map(int, input().split()))
a = [-1] + [int(eval(input())) for _ in range(m)] + [n + 1]
MOD = 10 ** 9 + 7

fib = [0, 1]
for i in range(100100):
	fib.append((fib[i] + fib[i + 1] % MOD))

res = 1
for i in range(m + 1):
	p, q = a[i], a[i + 1]
	res = (res * fib[q - p - 1]) % MOD

print(res)

# Optimized solution
n,m = list(map(int, input().split()))
a = [int(eval(input())) for _ in range(m)]
MOD = 10 ** 9 + 7

# broken[i] : i段目が壊れていたらTrue
broken = [False] * 100100
for i in a:
	broken[i] = True

# dp[i] : i段目に行く通り数
dp = [0] * 100100

# 0段目に行く方法は1通り
dp[0] = 1

# 1段目からn段目について調べる
for i in range(1, n + 1):
	# 壊れてるなら
	if broken[i]:
		# その段には進めないので0通り
		dp[i] = 0
	# 壊れてないなら
	else:
		# i - 1段目から移動可能 (i - 1段目は, i == 0 のときにはないので分岐)
		if i > 0:
			dp[i] += dp[i - 1]
		# i - 2段目から移動可能 (i - 2段目は, i == 0, 1 のときにはないので分岐)
		if i > 1:
			dp[i] += dp[i - 2]
	dp[i] %= MOD

print((dp[n]))
# Original solution
N, M = list(map(int, input().split()))

A = [True for i in range(N + 1)]

dp = [0 for i in range(N + 2)]

for i in range(M):
    a = int(eval(input()))
    A[a] = False

dp[0] = 1
for i in range(N):
    if A[i] == 0:
        continue
    dp[i + 1] += dp[i]
    dp[i + 1] %= 1000000007
    dp[i + 2] += dp[i]
    dp[i + 2] %= 1000000007

print((dp[N]))


# Optimized solution
N, M = list(map(int, input().split()))

A = [True for i in range(N + 2)]

dp = [0 for i in range(N + 3)]

for i in range(M):
    a = int(eval(input()))
    A[a] = False

dp[0] = 1
for i in range(N):
    if A[i] == False:
        continue
    dp[i + 1] += dp[i]
    dp[i + 1] %= 1000000007
    dp[i + 2] += dp[i]
    dp[i + 2] %= 1000000007

print((dp[N]))
# Original solution
import sys
N, M = list(map(int, input().split()))

a = [int(line) for line in sys.stdin]

ans = [-1] * (N + 1)  # not evaluated yet

for broken in a:
    ans[broken] = 0  # unreachable

ans[0] = 1  # reachable

if ans[1]:
    ans[1] = 1

for i in range(2, N + 1):
    if ans[i]:
        ans[i] = ans[i - 1] + ans[i - 2]

print((ans[N] % 1000000007))


# Optimized solution
import sys
N, M = list(map(int, input().split()))

ans = [-1] * (N + 1)  # not evaluated yet

for line in sys.stdin:
    ans[int(line)] = 0  # unreachable

ans[0] = 1  # reachable

if ans[1]:
    ans[1] = 1

for i in range(2, N + 1):
    if ans[i]:
        ans[i] = ans[i - 1] + ans[i - 2]

print((ans[N] % 1000000007))
# Original solution
n,m = list(map(int, input().split()))
a = [int(eval(input())) for i in range(m)]
memo = [0]*(n+1)

memo[0] = 1
if 1 in a:
    memo[1] = 0
else:
    memo[1] = 1
for i in range(2,n+1):
    if i in a:
        continue
    memo[i] = (memo[i-1] + memo[i-2])%1000000007

print((memo[n]))

# Optimized solution
n,m = list(map(int, input().split()))
a = set([int(eval(input())) for i in range(m)])
memo = [0]*(n+1)

memo[0] = 1
if 1 in a:
    memo[1] = 0
else:
    memo[1] = 1
for i in range(2,n+1):
    if i in a:
        continue
    memo[i] = (memo[i-1] + memo[i-2])%1000000007

print((memo[n]))
# Original solution
n, m = list(map(int, input().split()))
an = [0]*m

for i in range(m):
#    s = input()
    an[i] = int( eval(input()) )
#an[-1] = n

#an.sort()
disjoint = False
for i in range(len(an)-1):
    if an[i] + 1 == an[i+1]:
        disjoint = True


if disjoint:
    print((0))

else:

    mod = 10**9+7
    tab = [0]*(10**5+10)
    tab[0] = 0
    tab[1] = tab[2]= 1

    for i in range(3, len(tab)):
        tab[i] = tab[i-1]+tab[i-2]
#        if i<100:
#            print(tab[i])

    an.append(n)
    prev = 0
    ans = 1
    for a in an:
        index = a-prev + (1 if a == n else 0)
#        print(a,prev,index,tab[index])
        ans *= tab[index]
        ans %= mod
        prev = a+1

    #ans *= tab[n - prev]
    #ans %= 1000000007

    print(ans)



# Optimized solution
n, m = list(map(int, input().split()))
an = [0]*m

for i in range(m):
#    s = input()
    an[i] = int( eval(input()) )
#an[-1] = n

#an.sort()
disjoint = False
for i in range(len(an)-1):
    if an[i] + 1 == an[i+1]:
        disjoint = True


if disjoint:
    print((0))

else:

    mod = 10**9+7
    tab = [0]*(10**5+2)
    tab[0] = 0
    tab[1] = tab[2]= 1

    for i in range(3, len(tab)):
        tab[i] = tab[i-1]+tab[i-2]
#        if i<100:
#            print(tab[i])

    an.append(n)
    prev = 0
    ans = 1
    for a in an:
        index = a-prev + (1 if a == n else 0)
#        print(a,prev,index,tab[index])
        ans *= tab[index]
        ans %= mod
        prev = a+1

    #ans *= tab[n - prev]
    #ans %= 1000000007

    print(ans)
# Original solution
#import sys
#sys.setrecursionlimit(10 ** 7)

'''
#import numpy as np
import math, string, itertools, fractions, heapq, collections, re, array, bisect, copy, functools, random
from collections import deque, defaultdict, Counter
from heapq import heappush, heappop
from itertools import permutations, combinations, product, accumulate, groupby
from bisect import bisect_left, bisect_right, insort_left, insort_right
from operator import itemgetter as ig
#sys.setrecursionlimit(10 ** 7)
'''
#inf = 10 ** 20
'''
INF = float("INF")
mod = 10 ** 9 + 7
"""dd = [(-1, 0), (0, 1), (1, 0), (0, -1)];
ddn = dd + [(-1, 1), (1, 1), (1, -1), (-1, -1)];
ddn9 = ddn + [(0, 0)]
for dx, dy in dd:
        nx = j + dx; ny = i + dy
            if 0 <= nx < w and 0 <= ny < h:"""

def wi(): return list(map(int, sys.stdin.readline().split()))
def wip(): return [int(x) - 1 for x in sys.stdin.readline().split()]  # WideIntPoint
def ws(): return sys.stdin.readline().split()
def si(): return int(sys.stdin.readline())  # SingleInt
def ss(): return input()
def hi(n): return [si() for _ in range(n)]
def hs(n): return [ss() for _ in range(n)]  # HeightString
def s_list(): return list(input())
def mi(n): return [wi() for _ in range(n)]  # MatrixInt
def mip(n): return [wip() for _ in range(n)]
def ms(n): return [ws() for _ in range(n)]
def num_grid(n): return [[int(i) for i in sys.stdin.readline().split()[0]] for _ in range(n)]  # NumberGrid
def grid(n): return [s_list() for _ in range(n)]

'''
def main():
    N, M = list(map(int, input().split()))
    a = [int(eval(input())) for _ in range(M)]
    dp = [1] * N
    if 1 in a:
        dp[0] = 0
        for i in range(1,N):
            if i+1 in a:
                dp[i] = 0
            else:
                dp[i] = dp[i-1] + dp[i-2]
        print((dp[N-1] % (10**9+7)))
    else:
        for i in range(1,N):
            if i+1 in a:
                dp[i] = 0
            else:
                dp[i] = dp[i-1] + dp[i-2]
        print((dp[N-1] % (10**9+7)))

if __name__ == '__main__':
    main()


# Optimized solution
def main():
    N, M = list(map(int, input().split()))
    a = [int(eval(input())) for _ in range(M)]
    b = set(a)
    dp = [1] * N
    if 1 in a:
        dp[0] = 0
        for i in range(1, N):
            if i+1 in b:
                dp[i] = 0
            else:
                dp[i] = dp[i-1] + dp[i-2]
        print((dp[N-1] % (10**9+7)))
    else:
        for i in range(1, N):
            if i+1 in b:
                dp[i] = 0
            else:
                dp[i] = dp[i-1] + dp[i-2]
        print((dp[N-1] % (10**9+7)))


if __name__ == '__main__':
    main()
# Original solution
N, M = list(map(int, input().split()))
A = [int(eval(input())) for _ in range(M)]
P = 1
Q = 0 if 1 in A else 1
for i in range(N-1):
  p = 0 if i+2 in A else P+Q
  P, Q = Q%(10**9+7), p%(10**9+7)
print(Q)

# Optimized solution
N, M = list(map(int, input().split()))
A = [int(eval(input())) for _ in range(M)]
L = [0]*(N+1)
for a in A:
  L[a]=-1
L[0] = 1
L[1] += 1
for i in range(2, N+1):
  if L[i]==-1:
    L[i]=0
  else:
    L[i] = L[i-1]+ L[i-2]
print((L[-1]%(10**9+7)))
# Original solution
n, m = list(map(int, input().split()))
breaks = []
for _ in range(m):
  breaks.append(int(eval(input()))-1)
stairs = [0 for _ in range(n)]

if n == 1:
  print((1))
else:
  if 0 not in breaks:
    stairs[0]=1

  if 1 not in breaks:
    stairs[1]=1  

  for i in range(n):
    if i+1 not in breaks:
      if i+1>=n:
        pass
      else:
        stairs[i+1]=stairs[i]+stairs[i+1]
    if i+2 not in breaks:
      if i+2>=n:
        pass
      else:
        stairs[i+2]=stairs[i]+stairs[i+2]
    if i>3:
      if sum(stairs[i-3:]) == 0:
        break

  print((stairs[-1]%1000000007))
  

# Optimized solution
n, m = list(map(int, input().split()))
stairs = [1]*(n+1)
for _ in range(m):
  stairs[int(eval(input()))] = -1

flg = False
for i in range(2,n+1):
  if stairs[i]==-1:
    pass
  elif stairs[i-1]==-1 and stairs[i-2]==-1:
    flg=True
    break
  elif stairs[i-1]==-1:
    stairs[i] = stairs[i-2]
  elif stairs[i-2]==-1:
    stairs[i] = stairs[i-1]
  else:
    stairs[i] = stairs[i-1] + stairs[i-2]
if flg:
  print((0))
else:
  print((stairs[-1]%1000000007))
# Original solution
n, m = list(map(int, input().split()))
arr = [int(eval(input())) for _ in range(m)]
mod = 10 ** 9 + 7

dp = [0] * (n + 1)
dp[0] = 1

j = 0
for i in range(1, n + 1):
    if j < m and i == arr[j]:
        dp[i] = 0
        j += 1
        continue

    if i == 1:
        dp[1] = dp[0]
        continue

    dp[i] = dp[i - 1] + dp[i - 2]
    dp[i] %= mod

print((dp[n]))


# Optimized solution
n, m = list(map(int, input().split()))
arr = [int(eval(input())) for _ in range(m)]
broken = set(arr)

mod = 10 ** 9 + 7

dp = [0] * (n + 1)
dp[0] = 1


for i in range(1, n + 1):
    if i in broken:
        continue

    if i == 1:
        dp[1] = dp[0]
        continue

    dp[i] = dp[i - 1] + dp[i - 2]
    dp[i] %= mod

print((dp[n]))
# Original solution
n,m = list(map(int, input().split()))

a = []
for i in range(m):
    a.append(int(eval(input())))

dp = []
for dpi in range(n):
    dp.append(0)

for j in range(n):
    if j == 0 and j+1 not in a:
        dp[j] = 1
    elif j == 1 and j+1 not in a:
        dp[j] = dp[j-1] + 1
    elif j > 1 and j+1 not in a:
        dp[j] = dp[j-1] + dp[j-2]

print((dp[n-1] % 1000000007))

# Optimized solution
n,m = list(map(int, input().split()))

a = []
for i in range(m):
    a.append(int(eval(input())))

dp = []
for dpi in range(n):
    dp.append(0)

k = 0
a.append(0)
for j in range(n):
    if j+1 == a[k]:
        k += 1
        continue
    if j == 0:
        dp[j] = 1
    elif j == 1:
        dp[j] = dp[j-1] + 1
    elif j > 1:
        dp[j] = dp[j-1] + dp[j-2]

print((dp[n-1] % 1000000007))
# Original solution
import sys

N,M = list(map(int, input().split()))
A = [0]*M
for i in range(M):
    A[i] = int(eval(input()))

dp = [0]*(N+1)
if N == 1:
    if 1 in A:
        print('0')
        sys.exit()
    else:
        print('1')
        sys.exit()

if 1 in A:
    dp[1] = 0
else:
    dp[1] = 1
dp[0] = 1
for i in range(2, N+1):
    if i in A:
        dp[i] = 0
    else:
        dp[i] = dp[i-1]%1000000007 + dp[i-2]%1000000007

print((dp[N]%1000000007))

# Optimized solution
import sys

N,M = list(map(int, input().split()))

dp = [-1]*(N+1)
dp[0] = 1
dp[1] = 1
for i in range(M):
    num = int(eval(input()))
    dp[num] = 0

for i in range(2, N+1):
    if dp[i] == 0:
        continue
    dp[i] = dp[i-1]%1000000007 + dp[i-2]%1000000007

print((dp[N]%1000000007))
# Original solution
n, m = list(map(int, input().split()))
a = [int(eval(input())) for i in range(m)]
mod = 10**9+7
dp = [0]*(n+1)
dp[0], dp[1] = 1, 1
if 1 in a:
    dp[1] = 0
for i in range(2, n+1):
    if i not in a:
        dp[i] = dp[i-1] + dp[i-2]
        dp[i] %= mod
print((dp[n]))

# Optimized solution
n, m = list(map(int, input().split()))
a = [int(eval(input())) for i in range(m)]
mod = 10**9+7
dp = [1]*(n+1)
for i in a:
    dp[i] = 0
for i in range(2, n+1):
    if dp[i] > 0:
        dp[i] = dp[i-1] + dp[i-2]
        dp[i] %= mod
print((dp[n]))
# Original solution
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, list(range(n, n - r, -1)))
    under = reduce(mul, list(range(1,r + 1)))
    return over // under

def culcC(num):
    if num  < 2:
        return 1
    ret = 1
    minus2 = 1
    while(True):
        ret += cmb(num - minus2,minus2 if minus2 >0 else 1)
        minus2 += 1
        if num - 2 * minus2 < 0:
            break
    return ret
            
n,m = list(map(int,input().split()))
aa = [int(eval(input())) for i in range(m)]

if n == 1:
    print((1))
elif m == 0:
    print((culcC(n) % 1000000007))
else:
    ans = 1
    stand = 0
    for i,a in enumerate(aa):
#        連続穴
        if stand == a:
            ans = 0
            break
        step_num = a - stand - 1
        ans *= culcC(step_num)
        stand = a + 1
        
    # 最後のaからnまでで計算
    ans *= culcC(n - aa[-1] - 1)
    
    print((ans % 1000000007))

# Optimized solution
def fib(num):
    a, b = 0, 1 
    for _ in range(num - 1):
#         print(a)
        a, b = a + b, a
    return a + b

def culcC(num):
    if num  < 2:
         return 1
    return fib(num) + fib(num-1)
            
n,m = list(map(int,input().split()))
aa = [int(eval(input())) for i in range(m)]

if n == 1:
    print((1))
elif m == 0:
    print((culcC(n) % 1000000007))
else:
    ans = 1
    stand = 0
    for i,a in enumerate(aa):
#        連続穴
        if stand == a:
            ans = 0
            break
        step_num = a - stand - 1
        c = culcC(step_num)
        ans *= c if c > 0 else 1
        stand = a + 1
        
    # 最後のaからnまでで計算
    ans *= culcC(n - aa[-1] - 1)
    
    print((ans % 1000000007))
# Original solution
N,M = list(map(int,input().split()))
num = 1000000007

hole = [False]*(N+1)
a = [int(eval(input())) for _ in range(M)]
for i in a:
  hole[i] = True
  
dp = [0]*(N+1)
dp[0] = 1


for i in range(1,N+1):
  if i == 1:
    if hole[i] == True:
      dp[i] = 0
    else:
      dp[i] = dp[0]
  else:
    if hole[i] == True:
      dp[i] = 0
    else:
      dp[i] = dp[i-1] + dp[i-2]
print((dp[-1]%num))

# Optimized solution
n,m = list(map(int,input().split()))
a = set([int(eval(input())) for _ in range(m)])
dp = [0]*(n+1)
dp[0] = 1
for i in range(1,n+1):
  dp[i] = (dp[i-1]+dp[i-2])%(10**9+7)
  if i in a: dp[i]=0
print((dp[n]))
# Original solution
def xgcd(a, b):
    if b == 0:
        g = a
        x = 1
        y = 0
        return g, x, y
    else:
        g, s, t = xgcd(b, a%b)
        x = t
        y = s - a//b*x
        return g, x, y

def invmod(a, p):
    _, x, _ = xgcd(a, p)
    if x < 0:
        x = x + p
    return x

def count_route(n):
  if n < 0:
    return 0
  res = 0
  for i in range(n//2+1):
    res += f[n - i] * inv[i] * inv[n - 2* i]
  return res%const
    
n, m = list(map(int, input().split()))
const = 1000000007
#nまでの階乗をハッシュテーブルに格納する
f = [1 for i in range(n + 1)]
inv = [1 for i in range(n + 1)]
for i in range(1, n+1):
  f[i] = f[i - 1] * i
  inv[i] = invmod(f[i], const)
prev = 0
ans = 1
for i in range(m):
  m = int(eval(input()))
  ans = (ans * count_route(m - 1 - prev))%const
  prev = m + 1
  if ans == 0:
    break
ans = (ans * count_route(n - prev))%const
print(ans)

# Optimized solution
def xgcd(a, b):
    if b == 0:
        g = a
        x = 1
        y = 0
        return g, x, y
    else:
        g, s, t = xgcd(b, a%b)
        x = t
        y = s - a//b*x
        return g, x, y

def invmod(a, p):
    _, x, _ = xgcd(a, p)
    if x < 0:
        x = x + p
    return x

def count_route(n):
  if n < 0:
    return 0
  res = 0
  for i in range(n//2+1):
    res += f[n - i] * inv[i] * inv[n - 2* i]
  return res%const
    
n, m = list(map(int, input().split()))
const = 1000000007
#nまでの階乗をハッシュテーブルに格納する
f = [1 for i in range(n + 1)]
inv = [1 for i in range(n + 1)]
for i in range(1, n+1):
  f[i] = (f[i - 1] * i)%const
  inv[i] = invmod(f[i], const)
prev = 0
ans = 1
for i in range(m):
  m = int(eval(input()))
  ans = (ans * count_route(m - 1 - prev))%const
  prev = m + 1
  if ans == 0:
    break
ans = (ans * count_route(n - prev))%const
print(ans)
# Original solution
def xgcd(a, b):
    if b == 0:
        g = a
        x = 1
        y = 0
        return g, x, y
    else:
        g, s, t = xgcd(b, a%b)
        x = t
        y = s - a//b*x
        return g, x, y

def invmod(a, p):
    _, x, _ = xgcd(a, p)
    if x < 0:
        x = x + p
    return x

def count_route(n):
  if n < 0:
    return 0
  res = 0
  for i in range(n//2+1):
    res += f[n - i] * inv[i] * inv[n - 2* i]
  return res%const
    
n, m = list(map(int, input().split()))
const = 1000000007
#nまでの階乗をハッシュテーブルに格納する
f = [1 for i in range(n + 1)]
inv = [1 for i in range(n + 1)]
for i in range(1, n+1):
  f[i] = (f[i - 1] * i)%const
  inv[i] = invmod(f[i], const)
prev = 0
ans = 1
for i in range(m):
  m = int(eval(input()))
  ans = (ans * count_route(m - 1 - prev))%const
  prev = m + 1
  if ans == 0:
    break
ans = (ans * count_route(n - prev))%const
print(ans)

# Optimized solution
n , m = list(map(int, input().split()))
const = 1000000007
r = [1 for i in range(n+1)]
for i in range(m):
  r[int(eval(input()))] = 0
for i in range(2, n+1):
  if r[i] > 0:
    r[i] = (r[i-1] + r[i-2])%const
print((r[n]))
# Original solution
n, m = list(map(int, input().split()))

a = []
for i in range(m):
    a.append(int(eval(input())))

dp = [0] * (n + 1)
dp[0] = 1
for now in range(0, n + 1):
    for next_step in range(now + 1, min(n + 1, now + 3)):
        if not next_step in a:
            dp[next_step] += dp[now]
            dp[next_step] %= 1000000007

print((dp[n]))

# Optimized solution
n, m = list(map(int, input().split()))

a = []
for i in range(m):
    a.append(int(eval(input())))
a = set(a)

dp = [0] * (n + 1)
dp[0] = 1
for now in range(0, n + 1):
    for next_step in range(now + 1, min(n + 1, now + 3)):
        if not next_step in a:
            dp[next_step] += dp[now]
            dp[next_step] %= 1000000007

print((dp[n]))
# Original solution
#!/usr/bin/env python3
mod = 10**9 + 7
n, m = list(map(int, input().split()))
a = [int(eval(input())) for _ in range(m)]
ng = [False] * (10**5 + 1)
for x in a:
    ng[x] = True
dp = [0] * (n + 1)
dp[0] = 1
for i in range(n + 1):
    if i > 0 and not ng[i - 1]: dp[i] += dp[i - 1]
    if i > 1 and not ng[i - 2]: dp[i] += dp[i - 2]
    dp[i] %= mod
print((dp[n]))


# Optimized solution
#!/usr/bin/env python3
mod = 10**9 + 7
n, m = list(map(int, input().split()))
a = [int(eval(input())) for _ in range(m)]
ok = [True] * (n + 1)
for x in a:
    ok[x] = False
dp = [0] * (n + 1)
dp[0] = 1
for i in range(n + 1):
    if i > 0 and ok[i - 1]:
        dp[i] = (dp[i] + dp[i - 1]) % mod
    if i > 1 and ok[i - 2]:
        dp[i] = (dp[i] + dp[i - 2]) % mod
print((dp[n]))
# Original solution
#!/usr/bin/env python3
mod = 10**9 + 7
n, m = list(map(int, input().split()))
a = [int(eval(input())) for _ in range(m)]
ok = [True] * (n + 1)
for x in a:
    ok[x] = False
dp = [0] * (n + 1)
dp[0] = 1
for i in range(n + 1):
    if i > 0 and ok[i - 1]:
        dp[i] = (dp[i] + dp[i - 1]) % mod
    if i > 1 and ok[i - 2]:
        dp[i] = (dp[i] + dp[i - 2]) % mod
print((dp[n]))


# Optimized solution
#!/usr/bin/env python3
mod = 10**9 + 7
n, m = list(map(int, input().split()))
ok = [True] * (n + 1)
if m > 0:
    a = [int(eval(input())) for _ in range(m)]
    for x in a:
        ok[x] = False
dp = [0] * (n + 1)
dp[0] = 1
for i in range(n + 1):
    if i > 0 and ok[i - 1]:
        dp[i] = (dp[i] + dp[i - 1]) % mod
    if i > 1 and ok[i - 2]:
        dp[i] = (dp[i] + dp[i - 2]) % mod
print((dp[n]))