#include #include using namespace std; typedef long long int64; int64 fib[80 + 1] = {0, 1, 1}; int64 n, m; int solve(int i, int64 k, int d) { while(i >= 1 && k - fib[i] < m) i--; if(i < 1) return -1; if(k - fib[i] == m) return d + 1; return solve(i - 1, k - fib[i], d + 1); } int main(void) { cin >> n >> m; for(int i = 3; i <= n; i++) fib[i] = fib[i - 1] + fib[i - 2]; if(fib[n] == m) { cout << 0 << endl; return 0; } cout << solve(n - 2, fib[n], 0) << endl; return 0; }