#include<bits/stdc++.h> using namespace std; int m,n; int main(){ cin>>m>>n; for(int i=n;i>=1;i--){ if(m%i==0&&n%i==0){ cout<<i; break; } } }