def fib(n):

    if n <= 1:

        return n

    result = [1, 0, 0, 1]

    matrix = [1, 1, 1, 0]

    while n > 0:

        if n % 2:

            result = mul(matrix, result)

        matrix = mul(matrix, matrix)

        n //= 2

    return result[2]



def mul(a, b):

    return [a[0]*b[0] + a[1]*b[2],

            a[0]*b[1] + a[1]*b[3],

            a[2]*b[0] + a[3]*b[2],

            a[2]*b[1] + a[3]*b[3]]

    

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

if N == 1:

    print((1))

    quit()

S = [-1]

for i in range(M):

    S.append(int(eval(input())))

S.append(N + 1)

S = [S[i + 1] - S[i] for i in range(M + 1)]

if any([x == 1 for x in S]):

    print((0))

    exit()

num = 1

for x in S:

    num *=  fib(x - 1)

    num = num % 1000000007

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

if N == 1:

    print((1))

    quit()

S = [-1] * (N + 1)

S[0] = 1

for i in range(M):

    S[int(eval(input()))] = 0

if S[1] != 0:

    S[1] = 1

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

    if S[i] == 0:

        continue

    else:

        S[i] = (S[i - 1] + S[i - 2]) % 1000000007

        if S[i] == 0:

            print((0))

            quit()

print((S[N]))
def fib(n):
    if n <= 1:
        return n
    result = [1, 0, 0, 1]
    matrix = [1, 1, 1, 0]
    while n > 0:
        if n % 2:
            result = mul(matrix, result)
        matrix = mul(matrix, matrix)
        n //= 2
    return result[2]


def mul(a, b):
    return [
        a[0] * b[0] + a[1] * b[2],
        a[0] * b[1] + a[1] * b[3],
        a[2] * b[0] + a[3] * b[2],
        a[2] * b[1] + a[3] * b[3],
    ]


N, M = list(map(int, input().split()))
if N == 1:
    print((1))
    quit()
S = [-1]
for i in range(M):
    S.append(int(eval(input())))
S.append(N + 1)
S = [S[i + 1] - S[i] for i in range(M + 1)]
if any([x == 1 for x in S]):
    print((0))
    exit()
num = 1
for x in S:
    num *= fib(x - 1)
    num = num % 1000000007
print(num)

N, M = list(map(int, input().split()))
if N == 1:
    print((1))
    quit()
S = [-1] * (N + 1)
S[0] = 1
for i in range(M):
    S[int(eval(input()))] = 0
if S[1] != 0:
    S[1] = 1
for i in range(2, N + 1):
    if S[i] == 0:
        continue
    else:
        S[i] = (S[i - 1] + S[i - 2]) % 1000000007
        if S[i] == 0:
            print((0))
            quit()
print((S[N]))

-def fib(n): -    if n <= 1: -        return n -    result = [1, 0, 0, 1] -    matrix = [1, 1, 1, 0] -    while n > 0: -        if n % 2: -            result = mul(matrix, result) -        matrix = mul(matrix, matrix) -        n //= 2 -    return result[2] - - -def mul(a, b): -    return [ -        a[0] * b[0] + a[1] * b[2], -        a[0] * b[1] + a[1] * b[3], -        a[2] * b[0] + a[3] * b[2], -        a[2] * b[1] + a[3] * b[3], -    ] - - -S = [-1] +S = [-1] * (N + 1) +S[0] = 1 -    S.append(int(eval(input()))) -S.append(N + 1) -S = [S[i + 1] - S[i] for i in range(M + 1)] -if any([x == 1 for x in S]): -    print((0)) -    exit() -num = 1 -for x in S: -    num *= fib(x - 1) -    num = num % 1000000007 -print(num) +    S[int(eval(input()))] = 0 +if S[1] != 0: +    S[1] = 1 +for i in range(2, N + 1): +    if S[i] == 0: +        continue +    else: +        S[i] = (S[i - 1] + S[i - 2]) % 1000000007 +        if S[i] == 0: +            print((0)) +            quit() +print((S[N]))