m,n = input().split() m,n = int(m),int(n) x = m #x = n while x > 1: if m%x==0 and n%x==0: break x=x-1 print(x)