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