import sys,random,bisect from collections import deque,defaultdict from heapq import heapify,heappop,heappush from itertools import permutations from math import gcd,log N,M = map(int,input().split()) B = list(map(int,input().split())) def cond(x): val = [0 for i in range(M)] val[-1] = min(1+x,N-B[-1]) for i in range(M-2,-1,-1): val[i] = min(1+x,B[i+1]-B[i]+val[i+1]) check = sum(val)/M return check>=x ok = 0 ng = N T = 100 while T: mid = (ok+ng)/2 if cond(mid): ok = mid else: ng = mid T -= 1 x = ok val = [0 for i in range(M)] val[-1] = min(1+x,N-B[-1]) for i in range(M-2,-1,-1): val[i] = min(1+x,B[i+1]-B[i]+val[i+1]) print(val[0]+B[0]-1)