import math
print(math.factorial(5))

N, M = map(int, input().split())
a = []
for i in range(M):
  a.append(int(input()))
  
answer = 0
for i in range(len(a) - 1):
  dif = a[i + 1] - a[i]
  if dif >= 4:
    b = dif // 2
    tmp_sum = 0
    for j in range(b):
      tmp_sum += math.factorial(j + dif - j * 2) / (math.factorial(j) * math.factorial(dif - j * 2))
    if tmp_sum != 0 and answer = 1:
      answer += 1
    answer *= tmp_sum
    
print(answer)