N, @K = gets.chomp.split.map(&:to_i)

summary = 0

def double(n, count = 0)
  return count if n > @K
  double(n * 2, count + 1)
end

(1..N).each do |dice|
  summary += ((1 / 2.to_f)**double(dice)) * (1 / N.to_f) if dice < @K
  if dice >= @K
    summary += (1 / N.to_f)
  end
end

puts summary
