using System; using System.Collections; using System.Collections.Generic; using System.Collections.Specialized; using System.Text; using System.Text.RegularExpressions; using System.Linq; using System.IO; class Program { static void Main() { new Magatro().Solve(); } } class Magatro { private int N; private long M; private long[] Fib; private void Scan() { var line = Console.ReadLine().Split(' '); N = int.Parse(line[0]); M = long.Parse(line[1]); } public void Solve() { Scan(); Fib = new long[81]; Fib[0] = 0; Fib[1] = 1; Fib[2] = 1; for (int i = 3; i <= 80; i++) { Fib[i] = Fib[i - 1] + Fib[i - 2]; } long sa = Fib[N] - M; int ans = 0; for (int i = N - 2; i >= 1; i--) { if (Fib[i] <= sa) { ans++; sa -= Fib[i]; } } if (sa == 0) { Console.WriteLine(ans); } else { Console.WriteLine(-1); } } }