#include <atcoder/all>
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, s, t) for (ll i = s; i < (ll)(t); i++)

template<typename T>
bool chmin(T &x, T y) { return x > y ? (x = y, true) : false; }
template<typename T>
bool chmax(T &x, T y) { return x < y ? (x = y, true) : false; }

struct io_setup {
	io_setup() {
		ios::sync_with_stdio(false);
		std::cin.tie(nullptr);
		cout << fixed << setprecision(15);
	}
} io_setup;

int main(){
	int n,m;
	cin>>n>>m;
	vector<vector<int>> g(n);
	rep(i,0,m){
		int a,b;
		cin>>a>>b;
		a--; b--;
		g.at(a).push_back(b);
		g.at(b).push_back(a);
	}
	vector<int> sm(n+1,0);
	queue<pair<int,int>> q;
	q.push({0,0});
	vector<int> stl(n,0);
	while(!q.empty()){
		auto[nw,h]=q.front();
		q.pop();
		if(stl.at(nw)) continue;
		stl.at(nw)=1;
		sm.at(h)++;
		for(int nx:g.at(nw)){
			if(stl.at(nx)) continue;
			q.push({nx,h+1});
		}
	}
	int nw1=0,nw2=(sm.at(1)>0?1:0);
	rep(i,1,n+1){
		nw1+=sm.at(i);
		cout<<nw1<<"\n";
		swap(nw1,nw2);
	}
}