#include <bits/stdc++.h>
using namespace std;
int n, m;
int p[200001];
set<int> v[200001];
set<int> unused;
vector<int> components;
int c = 0;
void dfs(int x) {
  unused.erase(x);
  components[c]++;
  int curr = 0;
  while (1) {
    set<int>::iterator i = unused.upper_bound(curr);
    if (i == unused.end()) break;
    curr = *i;
    if (v[x].count(curr)) continue;
    dfs(curr);
  }
}
int main() {
  scanf("%d %d", &n, &m);
  for (int i = 0; i < m; i++) {
    int x, y;
    scanf("%d %d", &x, &y);
    v[x].insert(y);
    v[y].insert(x);
  }
  for (int i = 1; i <= n; i++) unused.insert(i);
  for (int i = 1; i <= n; i++)
    if (unused.count(i)) {
      components.push_back(0);
      dfs(i);
      c++;
    }
  sort(components.begin(), components.end());
  printf("%d\n", c);
  for (int i = 0; i < c; i++) printf("%d ", components[i]);
  printf("\n");
  return 0;
}
