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