import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int N = sc.nextInt(); int K = sc.nextInt(); int ans=divid(N); System.out.println(ans); } static int divid(int x){ if(x%2==0){ return x/2; }else{ int z=1; int rt=(int)Math.sqrt(x); for(int i=3;i<=rt; i+=2){ if(x%i==0){ z=x/i; break; } } return z; } } }