N, M = map(int, raw_input().split()) if N == M: print N else: print 1