#include<bits/stdc++.h>
using namespace std;
#define IO ios_base::sync_with_stdio(0), cin.tie(0),cout.tie(0)
typedef long long ll;
const int N = 1e5 + 4 , MOD = 1e9 + 7 ;
int num , load , ans ;
int solve(int x)
{
if(x <= load)
{
ans++ ;
return 0 ;
}
if(x % 2 ==0)
solve(x / 2) + solve(x / 2) ;
else
solve(x / 2) + solve((x + 1) / 2) ;
return ans ;
}
int main() {
IO ;
while (cin>>num>>load)
{
ans = 0 ;
cout<<solve(num)<<'\n' ;
}
return 0;
}
I2luY2x1ZGU8Yml0cy9zdGRjKysuaD4KdXNpbmcgbmFtZXNwYWNlIHN0ZDsKI2RlZmluZSBJTyBpb3NfYmFzZTo6c3luY193aXRoX3N0ZGlvKDApLCBjaW4udGllKDApLGNvdXQudGllKDApCnR5cGVkZWYgbG9uZyBsb25nIGxsOwpjb25zdCBpbnQgTiA9IDFlNSArIDQgLCBNT0QgPSAxZTkgKyA3IDsKaW50IG51bSAsIGxvYWQgLCBhbnMgOwppbnQgc29sdmUoaW50IHgpCnsKICAgIGlmKHggPD0gbG9hZCkKICAgIHsKICAgICAgICBhbnMrKyA7CiAgICAgICAgcmV0dXJuIDAgOwogICAgfQogICAgaWYoeCAlIDIgPT0wKQogICAgICAgIHNvbHZlKHggLyAyKSArIHNvbHZlKHggLyAyKSA7CiAgICBlbHNlCiAgICAgICAgc29sdmUoeCAvIDIpICsgc29sdmUoKHggKyAxKSAvIDIpIDsKICAgIHJldHVybiBhbnMgOwoKfQppbnQgbWFpbigpIHsKICAgIElPIDsKICAgIHdoaWxlIChjaW4+Pm51bT4+bG9hZCkKICAgIHsKICAgICAgICBhbnMgPSAwIDsKICAgICAgICBjb3V0PDxzb2x2ZShudW0pPDwnXG4nIDsKICAgIH0KICAgIHJldHVybiAwOwp9