import sys sys.setrecursionlimit(10**7) def I(): return int(sys.stdin.readline().rstrip()) def MI(): return map(int,sys.stdin.readline().rstrip().split()) def LI(): return list(map(int,sys.stdin.readline().rstrip().split())) def LI2(): return list(map(int,sys.stdin.readline().rstrip())) def S(): return sys.stdin.readline().rstrip() def LS(): return list(sys.stdin.readline().rstrip().split()) def LS2(): return list(sys.stdin.readline().rstrip()) N,M = MI() B = LI() if M == 1: print(N-1) exit() a = B[0]-1 B = [b-a for b in B] N -= a a += N-B[-1] b = 0 ans = a+B[-1]-1 for i in range(M-1,-1,-1): b += B[-1]-B[i] ans = min(ans,a+M/(M-i)+b/(M-i)) print(ans)