MOD = 10**9+7

N, M = map(int, input().split())
A = [int(input()) for _ in range(M)]
A.append(N+1)

now = 0
a0 = -1
ans = 1
for a in A:
    if a - a0 == 1:
        print(0)
        exit()
    else:
        tmp = 1
        for j in range(2, 10**9, 2):
          if (a - 1 - now - j + 1) > 0:
          	tmp += (a - 1 - now - j + 1)
          else:
            break
        ans = (ans%MOD) * tmp
        now = a + 1
        a0 = a
print(ans%MOD)