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

MOD = 1000000007 

D=[0] * (n+2)

D[0] = 1

for _ in range(m):

    D[int(eval(input()))] = -1

for i in range(n):

    if D[i] == -1:

        continue

    if D[i+1] != -1:

        D[i+1] += D[i]

    if D[i+2] != -1:

        D[i+2] += D[i]

    D[i]%=MOD

print((D[n] % MOD))
n,m=list(map(int,input().split()))

MOD = 1000000007 

D=[0] * (n + 1)

for _ in range(m):

    D[int(eval(input()))] = -1

for i in range(n+1):

    if D[i] == -1:

        continue

    if i in (0, 1):

        D[i] = 1

        continue

    if D[i-1] != -1:

        D[i] += D[i-1]

    if D[i-2] != -1:

        D[i] += D[i-2]

    D[i]%=MOD

print((D[i] % MOD))
n, m = list(map(int, input().split()))
MOD = 1000000007
D = [0] * (n + 2)
D[0] = 1
for _ in range(m):
    D[int(eval(input()))] = -1
for i in range(n):
    if D[i] == -1:
        continue
    if D[i + 1] != -1:
        D[i + 1] += D[i]
    if D[i + 2] != -1:
        D[i + 2] += D[i]
    D[i] %= MOD
print((D[n] % MOD))

n, m = list(map(int, input().split()))
MOD = 1000000007
D = [0] * (n + 1)
for _ in range(m):
    D[int(eval(input()))] = -1
for i in range(n + 1):
    if D[i] == -1:
        continue
    if i in (0, 1):
        D[i] = 1
        continue
    if D[i - 1] != -1:
        D[i] += D[i - 1]
    if D[i - 2] != -1:
        D[i] += D[i - 2]
    D[i] %= MOD
print((D[i] % MOD))

-D = [0] * (n + 2) -D[0] = 1 +D = [0] * (n + 1) -for i in range(n): +for i in range(n + 1): -    if D[i + 1] != -1: -        D[i + 1] += D[i] -    if D[i + 2] != -1: -        D[i + 2] += D[i] +    if i in (0, 1): +        D[i] = 1 +        continue +    if D[i - 1] != -1: +        D[i] += D[i - 1] +    if D[i - 2] != -1: +        D[i] += D[i - 2] -print((D[n] % MOD)) +print((D[i] % MOD))