let ceil_exponent i k = 
  let rec ceil_exponent' i k res = 
    if i * (1 lsl res) >= k then res 
    else ceil_exponent' i k (res + 1) in
  ceil_exponent' i k 0
;;

let p n = 0.5 ** n;;

let solve n k = 
  let rec sum' n k res = 
    if n = 0 then res 
    else sum' (n - 1) k (res +. (ceil_exponent n k |> float_of_int |> p)) in
  (sum' n k 0.) /. (float_of_int n)
;;

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