#include long long int n, m, f[80]; int main(void) { scanf("%lld%lld", &n, &m); long long int i; f[1] = 1, f[2] = 1; for(i = 3; i <= n; i++) { f[i] = f[i - 1] + f[i - 2]; } long long int r = f[n] - m, counter = 0; for(i = n - 2; 1 <= i; i--) { if(f[i] <= r) { r -= f[i]; counter++; } } printf("%lld\n", (r == 0 ? counter : -1) ); return 0; }