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