from collections import defaultdict





def read_input():

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



    d = defaultdict(lambda : True)

    for i in range(m):

        d[int(eval(input()))] = False



    return n, m, d









def submit():

    n, m, d = read_input()



    prev = 1

    prev_prev = 0

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

        curr = 0

        if d[i - 1]:

            curr += prev

        if d[i - 2]:

            curr += prev_prev



        curr %= 1000000007



        prev_prev = prev

        prev = curr



    print(curr)





if __name__ == '__main__':

    submit()

from collections import defaultdict





def read_input():

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



    d = defaultdict(lambda : True)

    for i in range(m):

        d[int(eval(input()))] = False



    return n, m, d





def submit():

    n, m, d = read_input()



    prev = 1

    prev_prev = 0

    curr = 1

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

        curr = 0

        if d[i - 1]:

            curr += prev

        if d[i - 2]:

            curr += prev_prev



        curr %= 1000000007



        prev_prev = prev

        prev = curr



    print(curr)





if __name__ == '__main__':

    submit()

from collections import defaultdict


def read_input():
    n, m = list(map(int, input().split()))
    d = defaultdict(lambda: True)
    for i in range(m):
        d[int(eval(input()))] = False
    return n, m, d


def submit():
    n, m, d = read_input()
    prev = 1
    prev_prev = 0
    for i in range(1, n + 1):
        curr = 0
        if d[i - 1]:
            curr += prev
        if d[i - 2]:
            curr += prev_prev
        curr %= 1000000007
        prev_prev = prev
        prev = curr
    print(curr)


if __name__ == "__main__":
    submit()

from collections import defaultdict


def read_input():
    n, m = list(map(int, input().split()))
    d = defaultdict(lambda: True)
    for i in range(m):
        d[int(eval(input()))] = False
    return n, m, d


def submit():
    n, m, d = read_input()
    prev = 1
    prev_prev = 0
    curr = 1
    for i in range(1, n + 1):
        curr = 0
        if d[i - 1]:
            curr += prev
        if d[i - 2]:
            curr += prev_prev
        curr %= 1000000007
        prev_prev = prev
        prev = curr
    print(curr)


if __name__ == "__main__":
    submit()

+    curr = 1