import java.util.*; class Main{ static int INF=100000007; static class edge implements Comparable{ int from; int to; void edge(int from,int to){ this.from=from; this.to=to; } public int compareTo(edge e){ return this.from-e.from; } } public static void main(String[] args){ Scanner sc=new Scanner(System.in); int N=sc.nextInt(); int K=sc.nextInt(); edge[] graph=new edge[N-1]; int[] dist=new int[N]; for(int i=0;idist[start]+1){ dist[end]=dist[start]+1; change=true; } } if(!change){ break; } } int count=0; for(int i=0;i