#include <bits/stdc++.h>
using namespace std;
const int N = 200005;
set<int> e[N], s;
int dfs(int u) {
  int res = 1;
  for (auto it = s.begin(); it != s.end();)
    if (!e[u].count(*it)) {
      int x = *it;
      s.erase(it);
      res += dfs(x);
      it = s.lower_bound(x);
    } else
      it++;
  return res;
}
int main() {
  int n, m;
  scanf("%d%d", &n, &m);
  for (int i = 0; i < m; ++i) {
    int u, v;
    scanf("%d%d", &u, &v);
    e[u].insert(v);
    e[v].insert(u);
  }
  for (int i = 1; i <= n; ++i) s.insert(i);
  vector<int> ans;
  for (int i = 1; i <= n; ++i) {
    if (s.empty()) break;
    if (s.count(i)) {
      s.erase(s.find(i));
      ans.push_back(dfs(i));
    }
  }
  sort(ans.begin(), ans.end());
  printf("%d\n", (int)ans.size());
  for (auto &x : ans) printf("%d ", x);
  return !printf("\n");
}
