a, b = map(int, input().strip().split()) for c in range(a + b, 0, -1): if a % c == 0 and b % c == 0: print(c) break