def Fib(n):

    a=[0,1,1]

    if n<=2:

    	return a[n]

    else:

    	for i in range(n-2):

    		a.append(a[i+1]+a[i+2])

    	return a[n]

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

if m==0:

	print((Fib(n+1)%(10**9+7)))

	exit()

a=[]

for i in range(m):

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

if a[0]!=1:

	a.insert(0,-1)

if a[-1]!=n-1:

	a.append(n+1)

b=[]

for i in range(len(a)-1):

	b.append(a[i+1]-a[i]-1)

	if a[i+1]-a[i]==1:

		print((0))

		exit()

ans=1

for i in range(len(b)):

	ans*=Fib(b[i])

	ans%=10**9+7

print(ans)
mod=10**9+7

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

a=[int(eval(input()))for _ in range(m)]

a.append(n+1)

fib=[1,1]

for i in range(n):

	r=fib[-1]+fib[-2]

	fib.append(r%mod)

ans=1

now=0

for x in a:

	ans*=fib[x-1-now]

	if x-1-now<0:

		print((0))

		exit()

	ans%=mod

	now=x+1

print(ans)
def Fib(n):
    a = [0, 1, 1]
    if n <= 2:
        return a[n]
    else:
        for i in range(n - 2):
            a.append(a[i + 1] + a[i + 2])
        return a[n]


n, m = list(map(int, input().split()))
if m == 0:
    print((Fib(n + 1) % (10**9 + 7)))
    exit()
a = []
for i in range(m):
    a.append(int(eval(input())))
if a[0] != 1:
    a.insert(0, -1)
if a[-1] != n - 1:
    a.append(n + 1)
b = []
for i in range(len(a) - 1):
    b.append(a[i + 1] - a[i] - 1)
    if a[i + 1] - a[i] == 1:
        print((0))
        exit()
ans = 1
for i in range(len(b)):
    ans *= Fib(b[i])
    ans %= 10**9 + 7
print(ans)

mod = 10**9 + 7
n, m = list(map(int, input().split()))
a = [int(eval(input())) for _ in range(m)]
a.append(n + 1)
fib = [1, 1]
for i in range(n):
    r = fib[-1] + fib[-2]
    fib.append(r % mod)
ans = 1
now = 0
for x in a:
    ans *= fib[x - 1 - now]
    if x - 1 - now < 0:
        print((0))
        exit()
    ans %= mod
    now = x + 1
print(ans)

-def Fib(n): -    a = [0, 1, 1] -    if n <= 2: -        return a[n] -    else: -        for i in range(n - 2): -            a.append(a[i + 1] + a[i + 2]) -        return a[n] - - +mod = 10**9 + 7 -if m == 0: -    print((Fib(n + 1) % (10**9 + 7))) -    exit() -a = [] -for i in range(m): -    a.append(int(eval(input()))) -if a[0] != 1: -    a.insert(0, -1) -if a[-1] != n - 1: -    a.append(n + 1) -b = [] -for i in range(len(a) - 1): -    b.append(a[i + 1] - a[i] - 1) -    if a[i + 1] - a[i] == 1: +a = [int(eval(input())) for _ in range(m)] +a.append(n + 1) +fib = [1, 1] +for i in range(n): +    r = fib[-1] + fib[-2] +    fib.append(r % mod) +ans = 1 +now = 0 +for x in a: +    ans *= fib[x - 1 - now] +    if x - 1 - now < 0: -ans = 1 -for i in range(len(b)): -    ans *= Fib(b[i]) -    ans %= 10**9 + 7 +    ans %= mod +    now = x + 1