include <bits/stdc++.h>
using namespace std; int main() {
int v,h,a;
int b=1,c=0;
cin>>v>>h;
while(h>0&&v>0)
{
for(int i=b;i>0&&h>0;i--)
{
v=v-h;
c++;
if(v<=0)
{
break;
}
}
h=h/2;
b++;
}
if(v<=0)
{
cout<<c;
}
else
{
cout<<v;
}
return 0;
}