(defn Partition [N M]
  (->> (iterate unchecked-dec-int (unchecked-divide-int M N))
    (filter #(zero? (unchecked-remainder-int M %)))
    first))
(println (Partition (unchecked-int (read)) (unchecked-int (read))))