#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5 + 100;
vector<int> g[maxn];
int din[maxn], root[maxn], n, m;
bool vis[maxn], st[maxn];
int res[maxn], siz[maxn];
int Find(int x) {
  if (x != root[x]) root[x] = Find(root[x]);
  return root[x];
}
int main() {
  cin >> n >> m;
  for (int i = 1; i <= n; i++) root[i] = i;
  for (int i = 1; i <= m; i++) {
    int u, v;
    cin >> u >> v;
    g[u].push_back(v);
    g[v].push_back(u);
    din[u]++;
    din[v]++;
  }
  int minn = 0x3f3f3f3f, pos = -1;
  for (int i = 1; i <= n; i++)
    if (din[i] < minn) {
      minn = din[i];
      pos = i;
    }
  for (int i = 0; i < g[pos].size(); i++) {
    int x = g[pos][i];
    vis[x] = 1;
  }
  for (int i = 1; i <= n; i++)
    if (!vis[i]) {
      root[i] = pos;
    }
  for (int i = 1; i <= n; i++) {
    if (!vis[i] || i == pos) {
      continue;
    }
    memset(st, 0, sizeof st);
    for (int j = 0; j < g[i].size(); j++) {
      int x = g[i][j];
      st[x] = 1;
    }
    for (int j = 1; j <= n; j++)
      if (!st[j]) {
        root[Find(j)] = Find(i);
      }
  }
  int cnt = 0;
  for (int i = 1; i <= n; i++)
    if (i == Find(i)) res[i] = ++cnt;
  for (int i = 1; i <= n; i++) siz[res[Find(i)]]++;
  sort(siz + 1, siz + 1 + cnt);
  cout << cnt << endl;
  for (int i = 1; i <= cnt; i++) cout << siz[i] << " ";
  return 0;
}
