#include <bits/stdc++.h>
using namespace std;
const int maxn = 200005;
const long long mod = 1e9 + 7;
const int INF = 0x3f3f3f3f;
const double eps = 1e-9;
int n, m;
vector<int> vec, mp;
map<int, bool> vis[maxn];
int bfs(int x) {
  queue<int> q;
  int cnt = 0;
  q.push(x);
  while (q.size()) {
    int u = q.front();
    q.pop();
    cnt++;
    for (int i = 0; i < mp.size(); i++) {
      int v = mp[i];
      if (!vis[u][v]) {
        swap(mp[i], mp.back());
        mp.pop_back();
        q.push(v);
        i--;
      }
    }
  }
  return cnt;
}
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 0; i < m; i++) {
    int x, y;
    scanf("%d%d", &x, &y);
    vis[x][y] = true;
    vis[y][x] = true;
  }
  for (int i = 1; i <= n; i++) {
    mp.push_back(i);
  }
  while (mp.size()) {
    int u = mp.back();
    mp.pop_back();
    int num = bfs(u);
    vec.push_back(num);
  }
  sort(vec.begin(), vec.end());
  printf("%d\n", vec.size());
  for (int i = 0; i < vec.size(); i++) {
    printf("%d ", vec[i]);
  }
  puts("");
}
