(defmacro inner-input []
  '(Integer/parseInt (read-line)))

(defn input []
  (list (inner-input) (inner-input)))

(defn AdditionAndMultiplication [[N K]]
  (let [an (Math/ceil (Math/sqrt K))]
    (int (+ (Math/pow 2 an) (* K (- N an))))))


(-> (input)
  AdditionAndMultiplication
  println)