#include<bits/stdc++.h> using namespace std; int main(){ int s,b; cin>>s>>b; int qq=__gcd(s,b); cout<<qq; return 0; }