N,M = map(int, input().split())
a = [0]*M
for i in range(M): a[i] = int(input())

mod = [1]*N
inv = [1]*N
inf = 10**9+7
for i in range(N-1): mod[i+1] = mod[i]*(i+2)%inf
inv[N-1] = pow(mod[N-1], inf-2, inf)
for i in range(2,N+1): inv[N-i] = inv[N-i+1]*(N-i+2)%inf

def comb(cur,ai):
    if ai - cur == 1:
        return 1
    elif ai <= cur:
        return 0
    return(comb(cur, ai-1)+comb(cur,ai-2))

cur = 1
if a[0] == 1: cur += 1
cnt = 0
for i in range(M):
    if cur == a[i]:
        cnt = 0
        break
    cnt += comb(cur,a[i])
    cur = a[i]+1

print(cnt)