#![allow(non_snake_case)] use std::cmp; use std::io::{ self, prelude::* }; macro_rules! pick { ($tokens:expr) => { $tokens.next().unwrap().parse().expect("parse error") } } fn main() { let mut s = String::new(); io::stdin().read_to_string(&mut s).expect("i/o error"); let mut tokens = s.split_whitespace(); let N: i64 = pick!(tokens); let K: i64 = pick!(tokens); let mut ans = 1; for d in 2.. { if d*d > N { break }; if N%d == 0 { if N/d >= K { ans = cmp::max(ans, d); } if d >= K { ans = cmp::max(ans, N/d); } } } println!("{}", ans); }