#include <bits/stdc++.h>
using namespace std;
const int MAX = 2e5 + 5;
int n, m, k, a, b;
vector<int> v[MAX], ss;
set<int> s[MAX];
bool M[MAX];
void dfs(int nod) {
  queue<int> Q;
  Q.push(nod);
  k = 0;
  M[nod] = true;
  while (!Q.empty()) {
    k++;
    nod = Q.front();
    Q.pop();
    for (int i = 0; i < v[nod].size(); i++) {
      int newn = v[nod][i];
      if (!M[newn]) {
        M[newn] = true;
        Q.push(newn);
      }
    }
  }
}
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 0; i < m; i++) {
    scanf("%d%d", &a, &b);
    s[a].insert(b);
    s[b].insert(a);
  }
  for (int i = 1; i < n; i++) {
    a = i;
    int can = 0;
    while (a < n && can < 20) {
      a++;
      if (s[i].find(a) == s[i].end())
        v[i].push_back(a), v[a].push_back(i), can++;
    }
  }
  for (int i = n; i > 1; i--) {
    a = i;
    int can = 0;
    while (a >= 2 && can < 20) {
      a--;
      if (s[i].find(a) == s[i].end())
        v[i].push_back(a), v[a].push_back(i), can++;
    }
  }
  for (int i = 1; i <= n; i++) {
    if (!M[i]) {
      k = 0;
      dfs(i);
      ss.push_back(k);
    }
  }
  sort(ss.begin(), ss.end());
  printf("%d\n", (int)ss.size());
  printf("%d", ss[0]);
  for (int i = 1; i < (int)ss.size(); i++) {
    printf(" %d", ss[i]);
  }
  printf("\n");
  return 0;
}
