############################################################# import sys sys.setrecursionlimit(10**7) from heapq import heappop,heappush from collections import deque,defaultdict,Counter from bisect import bisect_left, bisect_right from itertools import product,combinations,permutations ipt = sys.stdin.readline def iin(): return int(ipt()) def lmin(): return list(map(int,ipt().split())) ############################################################# N,M = lmin() A = [0]+lmin()+[N+1] ans = 0 for i in range(M+1): if (A[i+1]-A[i]-1)%2 and A[i+1]-A[i]-1 >= 3: ans += A[i+1]-A[i]-2 else: ans += A[i+1]-A[i]-1 print(ans)