#include <bits/stdc++.h>
using namespace std;
const int N = 200043;
set<int> g[N];
set<int> mas;
int cc = 0;
vector<int> comp;
void dfs(int x) {
  mas.erase(x);
  comp[cc]++;
  int cur = -1;
  while (true) {
    auto it = mas.upper_bound(cur);
    if (it == mas.end()) break;
    cur = *it;
    if (g[x].count(cur)) continue;
    dfs(cur);
  }
}
int main() {
  int n, m;
  cin >> n >> m;
  for (int i = 0; i < m; i++) {
    int x, y;
    scanf("%d %d", &x, &y);
    --x;
    --y;
    g[x].insert(y);
    g[y].insert(x);
  }
  for (int i = 0; i < n; i++) mas.insert(i);
  for (int i = 0; i < n; i++)
    if (mas.count(i)) {
      comp.push_back(0);
      dfs(i);
      cc++;
    }
  sort(comp.begin(), comp.end());
  printf("%d\n", cc);
  for (int i = 0; i < cc; i++) printf("%d ", comp[i]);
  return 0;
}
