N,M=map(int, input().split()) A=list(map(int, input().split())) if M==1: print(N-1) exit() b=A[0]-1+(N-A[-1]) cnt=M ans=N-1 def f(a,r): d=a/(1-r) return d e=0 cnt=1 for i in range(M-1,0,-1): r=i/M g=f(1,r) e+=A[-1]-A[i] ff=g+e/cnt cnt+=1 ans=min(ans,b+ff) print(ans)