#include using namespace std; #define ALL(x) x.begin(),x.end() #define rep(i,n) for(int i=0;i<(n);i++) #define debug(v) cout<<#v<<":";for(auto x:v){cout<bool chmax(T &a,const T &b){if(abool chmin(T &a,const T &b){if(b dep; vector> g; void dfs(int pre,int now){ for(auto to:g[now])if(to!=pre){ dep[to]=dep[now]+1; dfs(now,to); } } signed main(){ cin.tie(0); ios::sync_with_stdio(0); cin>>n>>k; dep.resize(n,0);g.resize(n); if(k>n){ cout<<-1<>a>>b;a--,b--; g[a].push_back(b); g[b].push_back(a); } dfs(-1,0); sort(ALL(dep)); // debug(dep); int ans=0; for(int i=1;i