#include using namespace std; #define rep(i,a,b) for(int i=a;i=b;i--) typedef long long ll; int N; ll M; int solve() { ll dp[81]; dp[1] = dp[2] = 1; rep(i, 3, N + 1) dp[i] = dp[i - 1] + dp[i - 2]; ll diff = dp[N] - M; if (diff < 0) return -1; ll sum = 0; rep(i, 1, N - 1) sum += dp[i]; if (sum < diff) return -1; int ans = 0; rrep(i, N - 2, 1) if(dp[i] <= diff) { ans++; diff -= dp[i]; } return ans; } int main() { cin.tie(0); ios::sync_with_stdio(false); while (cin >> N >> M) { cout << solve() << endl; } }