from collections import deque N, M = map(int, input().split()) to = [[] for _ in range(N)] for _ in range(M): u, v = map(int, input().split()) u, v = u-1, v-1 to[u].append(v) to[v].append(u) dist = [-1] * N que = deque([0]) dist[0] = 0 while que: v = que.popleft() for u in to[v]: if dist[u] != -1: continue dist[u] = dist[v] + 1 que.append(u) if not to[0]: print(*[1]*N, sep='\n') exit() ans = [0]*(N+1) for d in dist: if d == -1: continue ans[d] += 1 for i in range(N-1): ans[i+2] += ans[i] print(*ans[1:], sep='\n')