import sys

def input():

  return sys.stdin.readline().rstrip()

mod = 10**9 + 7

n, m = [int(i) for i in input().split()]

a = [int(eval(input())) for _ in range(m)]

notin = [1] * n

for i in a:

  notin[i] = 0

dp = [0] * n

dp[n - 1] = 1

if n > 1:

	dp[n - 2] = 1 + notin[n - 1]

for i in range(n - 3, -1, -1):

  dp[i] += dp[i + 1] * notin[i + 1] % mod

  dp[i] += dp[i + 2] * notin[i + 2] % mod

  dp[i] %= mod

print((dp[0]))
import sys





def read():

    return sys.stdin.readline().rstrip()





def main():

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

    a = {int(read()) - 1 for _ in range(m)}

    if n == 1:

        print((1))

        return

    mod = 10**9 + 7

    dp = [0] * n

    if 0 not in a:

        dp[0] = 1

    if 1 not in a:

        dp[1] = 1 + dp[0]

    for i in range(2, n):

        if i in a:

            continue

        dp[i] = (dp[i - 1] + dp[i - 2]) % mod

    print((dp[-1]))





if __name__ == '__main__':

    main()

import sys


def input():
    return sys.stdin.readline().rstrip()


mod = 10**9 + 7
n, m = [int(i) for i in input().split()]
a = [int(eval(input())) for _ in range(m)]
notin = [1] * n
for i in a:
    notin[i] = 0
dp = [0] * n
dp[n - 1] = 1
if n > 1:
    dp[n - 2] = 1 + notin[n - 1]
for i in range(n - 3, -1, -1):
    dp[i] += dp[i + 1] * notin[i + 1] % mod
    dp[i] += dp[i + 2] * notin[i + 2] % mod
    dp[i] %= mod
print((dp[0]))

import sys


def read():
    return sys.stdin.readline().rstrip()


def main():
    n, m = list(map(int, read().split()))
    a = {int(read()) - 1 for _ in range(m)}
    if n == 1:
        print((1))
        return
    mod = 10**9 + 7
    dp = [0] * n
    if 0 not in a:
        dp[0] = 1
    if 1 not in a:
        dp[1] = 1 + dp[0]
    for i in range(2, n):
        if i in a:
            continue
        dp[i] = (dp[i - 1] + dp[i - 2]) % mod
    print((dp[-1]))


if __name__ == "__main__":
    main()

-def input(): +def read(): -mod = 10**9 + 7 -n, m = [int(i) for i in input().split()] -a = [int(eval(input())) for _ in range(m)] -notin = [1] * n -for i in a: -    notin[i] = 0 -dp = [0] * n -dp[n - 1] = 1 -if n > 1: -    dp[n - 2] = 1 + notin[n - 1] -for i in range(n - 3, -1, -1): -    dp[i] += dp[i + 1] * notin[i + 1] % mod -    dp[i] += dp[i + 2] * notin[i + 2] % mod -    dp[i] %= mod -print((dp[0])) +def main(): +    n, m = list(map(int, read().split())) +    a = {int(read()) - 1 for _ in range(m)} +    if n == 1: +        print((1)) +        return +    mod = 10**9 + 7 +    dp = [0] * n +    if 0 not in a: +        dp[0] = 1 +    if 1 not in a: +        dp[1] = 1 + dp[0] +    for i in range(2, n): +        if i in a: +            continue +        dp[i] = (dp[i - 1] + dp[i - 2]) % mod +    print((dp[-1])) + + +if __name__ == "__main__": +    main()