#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int,int>;
const int N = 1e6+10;
int t,n,m,k,l,r,op,x,y;
int f[N];
unordered_set<int> st;
void solve(){
cin>>x>>y;
while(x){
st.insert(x);
x/=2;
}
while(y){
if(st.find(y)!=st.end()){
cout<<y;
return;
}
y/=2;
}
}
int main(){
ios::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
solve();
return 0;
}