#include using namespace std; typedef long long ll; typedef vector vi; typedef vector vl; typedef complex P; typedef pair pii; #define REP(i,n) for(ll i=0;i> n >> m; vl fib(n); fib[0] = 1; fib[1] = 1; FOR(i,2,n)fib[i] = fib[i-1]+fib[i-2]; if(fib[n-1] < m){ cout << -1 << endl; return 0; } ll sa = fib[n-1] - m; ll result = 0; ll iter = n-3; while(sa>0){ ++result; while(iter >= 0){ if(sa>=fib[iter]){ sa -= fib[iter]; --iter; break; } --iter; } if(iter == -1){ cout << -1 << endl; return 0; } } cout << result << endl; return 0; }