#include #include using namespace std; typedef long long ll; int main(){ int n; ll m; cin >> n >> m; vector fib(85); fib[0] = 0; fib[1] = fib[2] = 1; for(int i = 3; i < 85; i++) fib[i] = fib[i-1] + fib[i-2]; ll diff = fib[n]-m; if(diff < 0){ cout << -1 << endl; return 0; } int cnt = 0; for(int i = 80; i > 0; i--){ if(diff >= fib[i]) diff -= fib[i], cnt++; } if(diff) cout << -1 << endl; else cout << cnt << endl; return 0; }