N, M = map(int, input().split()) B = list(map(int, input().split())) minB = min(B) maxB = max(B) cnt = minB - 1 W =[] for b in B: if maxB - b < M and b - minB > M: W.append(N-b) if len(W) > 0: cnt += (sum(W)+M)/len(W) else: cnt += N - minB print(float(cnt))