#include using namespace std; long long FIB[81]; int main() { FIB[1] = 1; FIB[2] = 1; for (int i = 3; i < 81; i++)FIB[i] = FIB[i - 1] + FIB[i - 2]; long long n, m; cin >> n >> m; long long yukichan = FIB[n] - m; int cnt = 0; if (yukichan == 0)cnt=0; else if (yukichan < 0)cnt = -1; else { int last = n-2; while (yukichan) { for (int i = last; i > 0; i--) { if (FIB[i] <= yukichan) { yukichan -= FIB[i]; cnt++; last = i - 1; break; } } if (last == 0 && yukichan) { cnt = -1; break; } } } cout << cnt << endl; return 0; }