#include <iostream>
using namespace std;
int gcd(int x, int y)
{
for(int i = 1000; i > 0; i--)
if(x % i == 0 && y % i == 0)
return i;
return 1;
}
int main()
{
int x, y;
cin >> x >> y;
cout << gcd(x, y);
return 0;
}