#include #define rep(i,a,b) for(int i=int(a);i V; ll dfs(ll dif,int i){ if(dif == 0)return 0; if(dif >= V[i]){ return dfs(dif - V[i], i-1) + 1; } else return dfs(dif, i-1); } main(){ cin >> N >> M; V.resize(N); V[0] = V[1] = 1; rep(i,2,N)V[i] = V[i-1] + V[i-2]; ll dif = V[N-1] - M; //cout << dif << endl; if(dif >= 0)cout << dfs(dif, N-2) << endl; else cout << -1 << endl; //V[N-2]までの和でdifを表せるかどうか }