N, M = map(int, input().split())
A = []
index = 0
is_zero = False
patterns = []
ret = 1

for _ in range(M):
  a = int(input())
  dist = (a-1) - index
  if dist < 0:
    is_zero = True
    break
  A.append(dist)
  patterns.append(2**( dist // 2 + (dist % 2 if dist > 2 else 0)))
  ret *= 2**( dist // 2 + (dist % 2 if dist > 2 else 0))
  index = a+1
dist = N - index
A.append(dist)
patterns.append(2**( dist // 2 + (dist % 2 if dist > 2 else 0)))
ret *= 2**( dist // 2 + (dist % 2 if dist > 2 else 0))

if is_zero:
  print(0)
else:
  print(int(ret))