N,M=map(int,input().split()) A=list(map(int,input().split())) LIST=[] for i in range(1,len(A)): LIST.append(A[i]-A[i-1]-1) ANS=M while LIST: if LIST[-1]<=1: LIST.pop() elif LIST[-1]%2==0: LIST.pop() else: k=LIST[-1] ANS+=1 LIST.pop() l=k//2 LIST.append(l) LIST.append(l) print(N-ANS)