#include #include #include #include #include #include #include #include #include #include #include #include #include #define repd(i,a,b) for (int i=(a);i<(b);i++) #define rep(i,n) repd(i,0,n) #define var auto #define mod 1000000007 #define inf 2147483647 #define nil -1 typedef long long ll; using namespace std; inline int input(){ int a; cin >> a; return a; } template inline void output(T a, int p) { if(p){ cout << fixed << setprecision(p) << a << "\n"; } else{ cout << a << "\n"; } } // end of template int main() { cin.tie(0); // source code int N; ll M; cin >> N >> M; vector f(80); f[0] = f[1] = 1; repd(i, 2, 80){ f[i] = f[i - 1] + f[i - 2]; } int cnt = 0; //M = f[N - 1] - M; output(M, 0); for (int i = N - 3; i >= 0; i--){ if (M >= f[i]) { M -= f[i]; cnt++; } if (M == 0) { break; } } output((M == 0) ? cnt : -1, 0); return 0; }