(defn input []
  (->> (clojure.string/split (read-line) #"\s")
    (map #(bigint %))))

(defn gcd [X Y]
  (. (BigInteger. (str X)) gcd (BigInteger. (str Y))))

(defn inner-func [n divs]
    (if (= 1 n)
      (map list divs)
      (let [rs (inner-func (dec n) divs)]
        (for [f divs r rs]
          (lazy-cat (cons f r))))))

(defn inner-func2 [[f & r]]
  (if (empty? r)
    f
    (gcd f (inner-func2 r))))

(defn ProductandGCD [[N P]]
  (->> (range 1 (inc P))
    (filter #(zero? (rem P %)))
    (inner-func N)
    (remove #(< P (apply * %)))
    (map inner-func2)
    (apply max)))

(->> (input)
  ProductandGCD
  println)