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

broken=[False for i in range(n+1)]

for i in range(m):

    a=int(eval(input()))

    broken[a]=True

ans=[1]

if broken[1]:

    ans.append(0)

else:

    ans.append(1)

for i in range(2,n+1):

    if broken[i]:

        ans.append(0)

    else:

        ans.append((ans[i-1]+ans[i-2])%1000000007)

print((ans[n]))

#n=int(input())

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

#t=int(input())

#al=list(map(int,input().split()))

#l=[list(map(int,input().split())) for i in range(n)]



dp=[0]*(n+1)

mod=10**9+7

broken={i:False for i in range(1,n+1)}

for i in range(m):

    a=int(eval(input()))

    broken[a]=True

if broken[1]:

    dp[1]=0

else:

    dp[1]=1

dp[0]=1

for i in range(2,n+1):

    if not broken[i]:

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



print((dp[n]))

n, m = list(map(int, input().split()))
broken = [False for i in range(n + 1)]
for i in range(m):
    a = int(eval(input()))
    broken[a] = True
ans = [1]
if broken[1]:
    ans.append(0)
else:
    ans.append(1)
for i in range(2, n + 1):
    if broken[i]:
        ans.append(0)
    else:
        ans.append((ans[i - 1] + ans[i - 2]) % 1000000007)
print((ans[n]))

# n=int(input())
n, m = list(map(int, input().split()))
# t=int(input())
# al=list(map(int,input().split()))
# l=[list(map(int,input().split())) for i in range(n)]
dp = [0] * (n + 1)
mod = 10**9 + 7
broken = {i: False for i in range(1, n + 1)}
for i in range(m):
    a = int(eval(input()))
    broken[a] = True
if broken[1]:
    dp[1] = 0
else:
    dp[1] = 1
dp[0] = 1
for i in range(2, n + 1):
    if not broken[i]:
        dp[i] = (dp[i - 1] + dp[i - 2]) % mod
print((dp[n]))

+# n=int(input()) -broken = [False for i in range(n + 1)] +# t=int(input()) +# al=list(map(int,input().split())) +# l=[list(map(int,input().split())) for i in range(n)] +dp = [0] * (n + 1) +mod = 10**9 + 7 +broken = {i: False for i in range(1, n + 1)} -ans = [1] -    ans.append(0) +    dp[1] = 0 -    ans.append(1) +    dp[1] = 1 +dp[0] = 1 -    if broken[i]: -        ans.append(0) -    else: -        ans.append((ans[i - 1] + ans[i - 2]) % 1000000007) -print((ans[n])) +    if not broken[i]: +        dp[i] = (dp[i - 1] + dp[i - 2]) % mod +print((dp[n]))