import java.util.*; public class Main { public static void main (String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); long m = sc.nextLong(); long prepre = 1; long prev = 1; TreeSet set = new TreeSet<>(); set.add(1L); for (int i = 3; i <= n; i++) { long cur = prepre + prev; prepre = prev; prev = cur; set.add(prev); } long value = prev - m; if (value < 0) { System.out.println(-1); return; } int count = 0; while (value > 0) { value -= set.floor(value); count++; } System.out.println(count); } }