MOD = 10 ** 9 + 7


def resolve():
    N, M = map(int, input().split())

    A = [True] * N
    for _ in range(M):
        broken = int(input()) - 1
        A[broken] = False

    ans = 1
    for j in range(N - 2):
        if not A[j] and not A[j + 1]:
            print(0)
            return

        if A[j] and A[j + 1]:
            ans = ans * 2

    print(ans % MOD)


resolve()