long m,a[99];s;main(n){for(a[1]=1;++n<99;a[n]=a[n-1]+a[n-2]);for(scanf("%d%ld",&n,&m),m=a[n--]-m;--n;m/a[n]?m-=a[n],s++:0);s=!printf("%d",m?-1:s);}