#include using namespace std; const int inf=1001001001; int n,i,x,y,z,l,r,h,s[100100]; long long m,cnt; vector g[100100],f[100100]; void dfs(int i, int p, int d, int e, int w) { for (s[d]=w; eh; e++); cnt+=d-e; for (int j=0; j>n>>m; for (i=1; i=m) r=h; else l=h+1; } printf("%d\n",r==inf?-1:r); return 0; }