import java.math.*; import java.util.*; class Main { static int gcd(int dai,int syou){ if(syou==0) return dai; else return gcd(syou, dai%syou); } public static void main(String[] args) { Scanner sc = new Scanner(System.in); int x = sc.nextInt(); int y=sc.nextInt(); int ans=1; for(int i=1;i<=x/2;i++){ ans=Math.max(ans, gcd(x-i, i)); } System.out.println(ans); } }