import java.io.BufferedReader;
import java.io.InputStreamReader;
public class Solution {
public static void main(String[] args) throws Exception {
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
int number_a = Integer.parseInt(reader.readLine());
int number_b = Integer.parseInt(reader.readLine());
if(number_a < 1 || number_b < 1) {
throw new IllegalArgumentException();
}
while(number_a != 0 && number_b != 0){
int c = number_a % number_b;
if(c != 0){
number_a = number_b;
number_b = c;
c = number_a % number_b;
}else{
break;
}
}
System.out.println("最大公约数为:"+number_b);
}
}