#include <bits/stdc++.h>
using namespace std;
int n, k, u, v, sl, dem, kq[200001], tp;
set<int> s, a[200001];
set<int>::iterator it;
queue<int> kq2;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> k;
  for (int i = 1; i <= n; i++) s.insert(i);
  for (int i = 1; i <= k; i++) {
    cin >> u >> v;
    a[u].insert(v);
    a[v].insert(u);
  }
  while (!s.empty()) {
    tp = *s.begin();
    s.erase(tp);
    queue<int> que;
    que.push(tp);
    dem = 1;
    while (!que.empty()) {
      u = que.front();
      que.pop();
      for (it = s.begin(); it != s.end(); it++) {
        v = *it;
        if (a[u].find(v) == a[u].end()) {
          kq2.push(v);
          dem++;
          que.push(v);
        }
      }
      while (!kq2.empty()) {
        int w = kq2.front();
        s.erase(w);
        kq2.pop();
      }
    }
    kq[++sl] = dem;
  }
  sort(kq + 1, kq + sl + 1);
  cout << sl << "\n";
  for (int i = 1; i <= sl; i++) cout << kq[i] << " ";
}
