N, M = gets.split.map(&:to_i) B = gets.split.map(&:to_i) ans = N - 1 wp = B.select { |b| B.last <= b + M } r = Rational(M, wp.size) val = 0.0 wp.each do |b| cnt = B.first + r + (N - b) - 1 val += cnt end puts [ans, Rational(val, wp.size).to_f.round(12)].min