import math

def cal(x):
    if x == 0:
        return 0
    elif x == 1 or x == 2:
        return 1
    else:
        x-=2
        return (2**math.ceil(x/2) + 2**math.floor(x/2) -1)
"""input n,m """
n, m = map(int,input().split())
t = int(input())
arr = [t]
for i in range(m-1):
    r = int(input())
    arr.append(r-t-1)
    t = r
arr.append(n-t)
dem = cal(arr[0])
for i in range(1,len(arr)):
    dem*=cal(arr[i])
    dem%=1000000007
print(dem%1000000007)
