import java.io.*;

class Main{
    
        public static int max(int i, int k){
            if(k < i){
                return i;
            }else{
                return k;
            }

        }

    public static void main(String[] args){

        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
        try {       
                    String line = reader.readLine();
                    String[] strAry = line.split(" ");

                    int[] a = new int[strAry.length];

                    for(int i = 0; i < strAry.length; i ++){
                        a[i] = Integer.parseInt(strAry[i]);
                    }
                    int x = a[0];
                    int y = a[1];

                    if(y > x){
                        int k = y;
                        y = x;
                        x = k;
                    }

                    int yaku = 0, k = 1;
                    for(int i = 0; i <= (x % y); i++){

                        int m = x % k;
                        int n = (x % y) % k;
                        if((m == 0) && (n == 0)){
                            yaku = k;
                        }
                        k += 1;
                    }

                    if(x == y){
                        yaku = x;
                    }

                    System.out.println(yaku);
            
                            
        } catch (IOException e) {
            //TODO: handle exception
            System.out.println(e);
        }
    }
}
/tmp/hf-datasets-cache/medium/datasets/42704881117311-config-parquet-and-info-qiankunmu-Project_CodeNet-896c9d36/hub/datasets--qiankunmu--Project_CodeNet_Python800_and_Java250/snapshots/c899fde44a77ba1cc14973ed3de064e4ff3aadc7/Project_CodeNet_Java250.tar.gz