from collections import deque N,M = map(int,input().split()) G = {i:[] for i in range(1,N+1)} for _ in range(M): a,b = map(int,input().split()) G[a].append(b) G[b].append(a) dist = [-1]*(N+1) dist[1] = 0 que = deque([1]) while que: x = que.popleft() for y in G[x]: if dist[y]==-1: dist[y] = dist[x]+1 que.append(y) n = max(dist) C = {d:0 for d in range(n+1)} C[-1] = 0 for i in range(1,N+1): C[dist[i]] += 1 cnt0 = 1 cnt1 = 0 for i in range(1,N+1): if i>n:break if i%2==0: cnt0 += C[i] print(cnt0) else: cnt1 += C[i] print(cnt1) for i in range(n+1,N+1): if i%2==0: print(cnt0) else: print(cnt1)