#include <bits/stdc++.h>
using namespace std;
const int maxn = 200005;
int n, m, u, v;
set<int> edge[maxn], pt;
int main() {
  ios_base::sync_with_stdio(0);
  cin >> n >> m;
  for (int i = 0; i < m; i++) {
    cin >> u >> v;
    edge[u].insert(v);
    edge[v].insert(u);
  }
  vector<int> ans;
  for (int i = 1; i <= n; i++) pt.insert(i);
  while (!pt.empty()) {
    queue<int> que;
    ans.push_back(0);
    que.push(*pt.begin());
    pt.erase(que.front());
    while (!que.empty()) {
      int u = que.front();
      que.pop();
      ans.back()++;
      set<int> buf;
      for (auto &ig : pt) {
        if (edge[u].find(ig) == edge[u].end()) {
          que.push(ig);
          buf.insert(ig);
        }
      }
      for (auto ig : buf) {
        pt.erase(ig);
      }
    }
  }
  sort(ans.begin(), ans.end());
  cout << ans.size() << endl;
  for (auto ig : ans) {
    cout << ig << " ";
  }
  cout << endl;
  return 0;
}
