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

a = set([int(eval(input())) for i in range(M)])

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

dp[0] = 1

dp[1] = 1

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

  if (i-2 in a) and (i-1 in a):

    dp[-1] = 0

    break

  elif i-2 in a:

    dp[i] = dp[i-1]

  elif i-1 in a:

    dp[i] = dp[i-2]

  else:

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



print((dp[-1]%(7+10**9)))
N,M = list(map(int,input().split()))

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

a = set(a)



dp = [0]*(N+100)

for i in range(N+1):

  if i == 0:

    dp[i] = 1

    continue

  if i in a:

    continue

  elif i-1 in a:

    dp[i] = dp[i-2]

  elif i-2 in a:

    dp[i] = dp[i-1]

  elif i-1 in a and i-2 in a:

    break

  else:

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

  dp[i] = dp[i]%(7+10**9)

    

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

N, M = list(map(int, input().split()))
a = [int(eval(input())) for i in range(M)]
a = set(a)
dp = [0] * (N + 100)
for i in range(N + 1):
    if i == 0:
        dp[i] = 1
        continue
    if i in a:
        continue
    elif i - 1 in a:
        dp[i] = dp[i - 2]
    elif i - 2 in a:
        dp[i] = dp[i - 1]
    elif i - 1 in a and i - 2 in a:
        break
    else:
        dp[i] = dp[i - 1] + dp[i - 2]
    dp[i] = dp[i] % (7 + 10**9)
print((dp[N] % (7 + 10**9)))

-a = set([int(eval(input())) for i in range(M)]) -dp = [0 for i in range(N + 1)] -dp[0] = 1 -dp[1] = 1 -for i in range(2, N + 1): -    if (i - 2 in a) and (i - 1 in a): -        dp[-1] = 0 -        break +a = [int(eval(input())) for i in range(M)] +a = set(a) +dp = [0] * (N + 100) +for i in range(N + 1): +    if i == 0: +        dp[i] = 1 +        continue +    if i in a: +        continue +    elif i - 1 in a: +        dp[i] = dp[i - 2] -    elif i - 1 in a: -        dp[i] = dp[i - 2] +    elif i - 1 in a and i - 2 in a: +        break -print((dp[-1] % (7 + 10**9))) +    dp[i] = dp[i] % (7 + 10**9) +print((dp[N] % (7 + 10**9)))