object Main {
  import java.util.Scanner

  implicit class RichScanner(sc: Scanner) {
    def readStrings(n: Int): Array[String] = Array.fill(n) { sc.next() }
    def readInts(n: Int): Array[Int] = Array.fill(n) { sc.nextInt() }
    def readLongs(n: Int): Array[Long] = Array.fill(n) { sc.nextLong() }
    def readLineStrings: Array[String] = sc.nextLine().split(' ')
    def readLineInts: Array[Int] = readLineStrings.map(_.toInt)
    def readLineLongs: Array[Long] = readLineStrings.map(_.toLong)
  }

  def main(args: Array[String]): Unit = solve(new Scanner(System.in))

  def sumProbOfWinning(n: Int, k: Int): Double = {
    if (k == 1) return 0

    val nextBoundary = (k + 1) / 2

    val winIfSuccessfulRange = {
      if (n * 2 < k) 0
      else Math.min(n + 1, k) - nextBoundary
    }

    winIfSuccessfulRange / 2.0 + sumProbOfWinning(n, nextBoundary) / 2.0
  }

  def solve(sc: Scanner): Unit = {
    val Array(n, k) = sc.readLineInts

    val sum = if (n >= k) {
      (n - k + 1) + sumProbOfWinning(k - 1, k)
    } else {
      sumProbOfWinning(n, k)
    }

    println(sum / n)
  }
}
