# coding: utf-8
import sys

n, m = [int(x) for x in input().rstrip().split(" ")]

broken_stairs = []
stair_tmp = -1
for i in range(m):
    stair = int(input())
    if stair - stair_tmp == 1:
        print(0)
        sys.exit(0)
    stair_tmp = stair
    broken_stairs.append(stair)

last_section = n + 1
broken_stairs.append(last_section)
pattern = 1
for i in range(len(broken_stairs) - 1):
    section_pattern = 0
    section_length = broken_stairs[i + 1] - broken_stairs[i] - 1
    if section_length <= 2:
        section_pattern += 1
        pattern *= section_pattern
        continue
    if section_length == 3:
        section_pattern += 2
        pattern *= section_pattern
        continue
    r = int(section_length / 2) if section_length % 2 == 1 else -1 + (section_length // 2)
    pattern *= (2 ** r)

print(pattern % 1000000007)
