
#include <bits/stdc++.h>
using namespace std;
int n, x;
int main()
{
ios::sync_with_stdio(false);
cin.tie(nullptr), cout.tie(nullptr);
cin >> x >> n;
if (n == 1) return cout << "0", 0;
else if (x <= 2)return cout << "inf", 0;
double k = (n - 2) / (log(x) / log(2) - 1);
double kk = log(k) / log(2);
cout << ceil(kk);
return 0;
}