#include using namespace std; using i64 = int64_t; i64 f[100]; int main() { f[1] = f[2] = 1; // 题面如此( for (int i = 3; i < 81; i++) f[i] = f[i - 1] + f[i - 2]; i64 n, m; cin >> n >> m; i64 diff = f[n] - m; int ans = 0; for (int i = n - 2; i > 0; i--) if (diff >= f[i]) diff -= f[i], // i influnce = Fib[i] ans++; if (diff == 0) cout << ans << endl; else cout << -1 << endl; return 0; }