fun main(args:Array) { val (n, k) = readLine()!!.split(" ").map { it.toLong() } if(k == 1L) { println(n) return } val maxIndex = Math.sqrt(n.toDouble()).toLong() var ans = 1L for(i in (1..maxIndex)) { if(n % i != 0L) { continue } val num = (n/i).let { listOf(it, n / it) }.sortedDescending() for(j in num) { val tmp = n / j if(2 <= tmp) { ans = Math.max(ans, j) } } } println(ans) }