N, M = map(int, input().split()) B = list(map(int, input().split())) sumB = sum(B) cnt = B[0] - 1 + N - B[-1] avg = sum(B)/M W =[] minExp = B[-1]-B[0] for k in range(1, M): sumB -= B[k-1] exp = M / (M-k) + 1 / (M-k) * (B[-1]*(M-k) - sumB) minExp = min(minExp, exp) print(float(cnt+minExp))