n, m = map(int, input().split())

a = []
for i in range(m):
    a.append(int(input()))

ways = 1
j = 0
while(j < n):
    if not j in a:
        tmp_ways = 0
        # 1step
        if not j + 1 in a:
            tmp_ways += 1
        # 2step
        if (not j + 2 in a) and (j < n - 1):
            tmp_ways += 1

        if tmp_ways == 2:
            ways *= 2
        elif tmp_ways == 0:
            ways = 0
            break
    #print(j, tmp_ways)
    j += 1

print(ways % 1000000007)