n,m = map(int,input().split()) from math import gcd print(gcd(n,m))