let f i k = 
  let res = ref 0 in
  while i * (1 lsl !res) < k do
    res := !res + 1
  done;
  !res
;;

let g n = 0.5 ** n;;

let rec sum n k p = if n = 0 then 0. else sum (n - 1) k (p +. (f n k |> float_of_int |> g));;

let sum n k = (sum n k 0.) /. (float_of_int n);;

let () = Scanf.scanf "%d %d" (fun n k -> print_float (sum n k));;