#include <bits/stdc++.h>
#pragma GCC optimize("O3")
using namespace std;
vector<int> adj[200000], vis(200000);
int n, m;
int search(int cur) {
  int ret = 0;
  vector<int> ad(n);
  for (int i = 0; i < n; i++) ad[i] = i;
  queue<int> q;
  q.push(cur);
  while (!q.empty()) {
    ret++;
    int tp = q.front();
    q.pop();
    vis[tp] = 1;
    int ci = 0, ni = 0;
    vector<int> temp;
    while (ni < adj[tp].size() && ci < ad.size()) {
      if (ad[ci] == adj[tp][ni]) {
        temp.push_back(ad[ci]);
        ci++;
        ni++;
      } else if (ad[ci] > adj[tp][ni])
        ni++;
      else {
        if (!vis[ad[ci]]) q.push(ad[ci]);
        ci++;
      }
    }
    while (ci < ad.size()) {
      if (!vis[ad[ci]]) q.push(ad[ci]);
      ci++;
    }
    ad.swap(temp);
  }
  return ret;
}
int main() {
  cin >> n >> m;
  for (int i = 0; i < m; i++) {
    int u, v;
    cin >> u >> v;
    u--, v--;
    adj[u].push_back(v);
    adj[v].push_back(u);
  }
  for (int i = 0; i < n; i++) sort(adj[i].begin(), adj[i].end());
  vector<int> ans;
  for (int i = 0; i < n; i++)
    if (!vis[i]) ans.push_back(search(i));
  sort(ans.begin(), ans.end());
  cout << ans.size() << endl;
  for (int i : ans) cout << i << " ";
  cin >> n;
}
