import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int N = scan.nextInt(); int K = scan.nextInt(); scan.close(); if(K == 1) { System.exit(0); } int ans = 1; for(int i = N - 1; i >= 2; i--) { if(N % i == 0) { ans = i; break; } } System.out.println(ans); } }