N, M = map(int, input().split())

ret = list([2]*N)
ret[0] = 1

for m in range(M):
  idx = int(input()) - 1
  ret[idx] = -1

  if idx < (N - 2):
    ret[idx+2] = ret[idx+2] - 1
  if idx < (N - 1):
    ret[idx+1] = ret[idx+1] - 1
#  print(ret)

ans = 1
for r in ret:
  ans *= abs(r)

print(ans % 1000000007)