def main():

    import sys

    input = sys.stdin.readline

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

    a = []

    A = [0] * (1 + 10 ** 5)

    for _ in range(M):

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

    dp = [0] * (N + 1)

    dp[0] = 1

    if A[1]:

        dp[1] = 0

    else:

        dp[1] = 1

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

        if A[i]:

            dp[i] = 0

        else:

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

            dp[i] %= 1000000007

    print((dp[N]))

if __name__ == '__main__':

    main()   
import sys

input = lambda : sys.stdin.readline().rstrip()

mod = 10**9 + 7



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

a = []

for _ in range(m):

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

a = set(a)

dp = [0]*(n + 1)

dp[0] = 1

for i in range(n):

    if i + 2 not in a and i + 2 <= n:

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

        dp[i + 2] %= mod

    if i + 1 not in a:

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

        dp[i + 1] %= mod

print((dp[-1]))
def main():
    import sys

    input = sys.stdin.readline
    N, M = list(map(int, input().split()))
    a = []
    A = [0] * (1 + 10**5)
    for _ in range(M):
        A[int(eval(input()))] = 1
    dp = [0] * (N + 1)
    dp[0] = 1
    if A[1]:
        dp[1] = 0
    else:
        dp[1] = 1
    for i in range(2, N + 1):
        if A[i]:
            dp[i] = 0
        else:
            dp[i] = dp[i - 1] + dp[i - 2]
            dp[i] %= 1000000007
    print((dp[N]))


if __name__ == "__main__":
    main()

import sys

input = lambda: sys.stdin.readline().rstrip()
mod = 10**9 + 7
n, m = list(map(int, input().split()))
a = []
for _ in range(m):
    a.append(int(eval(input())))
a = set(a)
dp = [0] * (n + 1)
dp[0] = 1
for i in range(n):
    if i + 2 not in a and i + 2 <= n:
        dp[i + 2] += dp[i]
        dp[i + 2] %= mod
    if i + 1 not in a:
        dp[i + 1] += dp[i]
        dp[i + 1] %= mod
print((dp[-1]))

-def main(): -    import sys +import sys -    input = sys.stdin.readline -    N, M = list(map(int, input().split())) -    a = [] -    A = [0] * (1 + 10**5) -    for _ in range(M): -        A[int(eval(input()))] = 1 -    dp = [0] * (N + 1) -    dp[0] = 1 -    if A[1]: -        dp[1] = 0 -    else: -        dp[1] = 1 -    for i in range(2, N + 1): -        if A[i]: -            dp[i] = 0 -        else: -            dp[i] = dp[i - 1] + dp[i - 2] -            dp[i] %= 1000000007 -    print((dp[N])) - - -if __name__ == "__main__": -    main() +input = lambda: sys.stdin.readline().rstrip() +mod = 10**9 + 7 +n, m = list(map(int, input().split())) +a = [] +for _ in range(m): +    a.append(int(eval(input()))) +a = set(a) +dp = [0] * (n + 1) +dp[0] = 1 +for i in range(n): +    if i + 2 not in a and i + 2 <= n: +        dp[i + 2] += dp[i] +        dp[i + 2] %= mod +    if i + 1 not in a: +        dp[i + 1] += dp[i] +        dp[i + 1] %= mod +print((dp[-1]))