import sys
sys.setrecursionlimit(100001)

CONST = 1000000007

def noboru(i, a2, a1):
    if (i == 0 or i == 1):
        return a1 % CONST
    elif (i == 2):
        return a2 % CONST
    else:
        return noboru(i-1, (a2+a1) % CONST, a2 % CONST)


def func(N, M, a):
    ans = 1
    pos = 0
    for i in range(M):
        if (pos == a[i]):
            return 0
        else:
            ans = (ans * noboru(a[i] - pos - 1, 2, 1)) % CONST
            pos = a[i] + 1
    ans = (ans * noboru(N - pos, 2, 1)) % CONST
    return ans

N, M = map(int, input().split(" "))
a = [int(input()) for _ in range(M)]
print(func(N, M, a))
# print(noboru(10000, 2, 1))
# print(sys.getrecursionlimit())