import sys

sys.setrecursionlimit(1000000)



mod = 1000000007



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

good = [True] * (n+1)

for _ in range(m):

    x = int(eval(input()))

    good[x] = False



dp = [0] * (n+1)

dp[0] = 1



for i in range(n):

    # 出発点になれるなら、のみでOK

        # Falseの部分が更新されることはあっても、出発点になれないから

    if good[i]:

        if i+1 <= n:

            dp[i+1] += dp[i]

            dp[i+1]%= mod

        if i+2 <= n:

            dp[i+2] += dp[i]

            dp[i+2] %= mod



print((dp[n]))

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

broken = [0] * (n+1)

mod = 10**9+7

for i in range(m):

    broken[int(eval(input()))] = 1

dp = [0] * (n+1)

dp[0] = 1

if broken[1]:

    dp[1] = 0

else:

    dp[1] = 1

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

    if not broken[i]:

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

print((dp[n]))





 
import sys

sys.setrecursionlimit(1000000)
mod = 1000000007
n, m = list(map(int, input().split()))
good = [True] * (n + 1)
for _ in range(m):
    x = int(eval(input()))
    good[x] = False
dp = [0] * (n + 1)
dp[0] = 1
for i in range(n):
    # 出発点になれるなら、のみでOK
    # Falseの部分が更新されることはあっても、出発点になれないから
    if good[i]:
        if i + 1 <= n:
            dp[i + 1] += dp[i]
            dp[i + 1] %= mod
        if i + 2 <= n:
            dp[i + 2] += dp[i]
            dp[i + 2] %= mod
print((dp[n]))

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

-import sys - -sys.setrecursionlimit(1000000) -mod = 1000000007 -good = [True] * (n + 1) -for _ in range(m): -    x = int(eval(input())) -    good[x] = False +broken = [0] * (n + 1) +mod = 10**9 + 7 +for i in range(m): +    broken[int(eval(input()))] = 1 -for i in range(n): -    # 出発点になれるなら、のみでOK -    # Falseの部分が更新されることはあっても、出発点になれないから -    if good[i]: -        if i + 1 <= n: -            dp[i + 1] += dp[i] -            dp[i + 1] %= mod -        if i + 2 <= n: -            dp[i + 2] += dp[i] -            dp[i + 2] %= mod +if broken[1]: +    dp[1] = 0 +else: +    dp[1] = 1 +for i in range(2, n + 1): +    if not broken[i]: +        dp[i] = (dp[i - 1] + dp[i - 2]) % mod