#include <bits/stdc++.h>
class snp {
 public:
  snp(int n) {
    mas = new int[n + 1];
    for (int i = 1; i <= n; i++) mas[i] = i;
  }
  ~snp() { delete[] mas; }
  int get(int v) {
    if (v == mas[v])
      return v;
    else
      return mas[v] = get(mas[v]);
  }
  void set(int v, int gr) { mas[v] = gr; }

 private:
  int *mas;
};
std::map<int, std::set<int>> not_way;
snp *s;
std::set<int> not_used;
std::set<int>::iterator it;
int n, m;
int dfs(int v, int gr) {
  int count = 1;
  not_used.erase(v);
  s->set(v, gr);
  int i = 0;
  while (!not_used.empty()) {
    it = not_used.upper_bound(i);
    if (it == not_used.end()) break;
    i = *it;
    if (not_way[v].find(i) == not_way[v].end()) count += dfs(i, gr);
  }
  return count;
}
int main() {
  scanf("%d%d", &n, &m);
  s = new snp(n + 1);
  for (int i = 1; i <= n; i++) not_used.insert(i);
  int a, b;
  for (int i = 0; i < m; i++) {
    scanf("%d%d", &a, &b);
    not_way[a].insert(b);
    not_way[b].insert(a);
  }
  int group = 1;
  int *groups = new int[n + 1];
  int i = 0;
  while (!not_used.empty()) {
    it = not_used.upper_bound(i);
    if (it == not_used.end()) break;
    i = *it;
    groups[group] = dfs(i, group);
    group++;
  }
  printf("%d\n", group - 1);
  std::sort(groups + 1, groups + group);
  for (int i = 1; i < group; i++) printf("%d ", groups[i]);
  delete s;
  delete groups;
  return 0;
}
