N,M=map(int,input().split()) A=list(map(int,input().split())) ans=N-M for i in range(M-1): if A[i]-A[i+1]!=-2: ans-=(A[i]-A[i+1]+1)%2 print(ans)