#include <bits/stdc++.h>
using namespace std;
const int N = 200000 + 10;
vector<int> inpoints, size;
bool ina[N];
int n, m, fa[N], sz[N], deg[N], a, mina, cnt[N], tot;
set<pair<int, int> > edgesa;
pair<int, int> edges[N];
int find(int u) { return fa[u] == u ? u : fa[u] = find(fa[u]); }
int main() {
  std::ios_base::sync_with_stdio(false);
  cin.tie(0);
  cin >> n >> m;
  for (int i = 0; i < m; i++) {
    cin >> edges[i].first >> edges[i].second;
    deg[edges[i].first]++;
    deg[edges[i].second]++;
  }
  mina = N;
  for (int i = 1; i <= n; i++)
    if (deg[i] < mina) {
      mina = deg[i];
      a = i;
    }
  for (int i = 0; i < m; i++)
    if (a == edges[i].first) {
      ina[edges[i].second] = true;
      inpoints.push_back(edges[i].second);
      tot++;
    } else if (a == edges[i].second) {
      ina[edges[i].first] = true;
      inpoints.push_back(edges[i].first);
      tot++;
    }
  for (int i = 1; i <= n; i++)
    if (!ina[i]) {
      fa[i] = a;
      sz[a]++;
    }
  for (int i = 0; i < m; i++) {
    if (ina[edges[i].first] && !ina[edges[i].second])
      cnt[edges[i].first]++;
    else if (!ina[edges[i].first] && ina[edges[i].second])
      cnt[edges[i].second]++;
    else if (ina[edges[i].first] && ina[edges[i].second])
      edgesa.insert(edges[i]);
  }
  for (int u : inpoints) {
    if (cnt[u] < n - tot) {
      fa[u] = a;
      sz[a]++;
    } else {
      fa[u] = u;
      sz[u] = 1;
    }
  }
  for (int i = 0; i < inpoints.size(); i++)
    for (int j = i + 1; j < inpoints.size(); j++)
      if (!edgesa.count(pair<int, int>(inpoints[i], inpoints[j])) &&
          !edgesa.count(pair<int, int>(inpoints[j], inpoints[i]))) {
        int u = find(inpoints[i]), v = find(inpoints[j]);
        if (u != v) {
          fa[u] = v;
          sz[v] += sz[u];
        }
      }
  for (int i = 1; i <= n; i++)
    if (fa[i] == i) size.push_back(sz[i]);
  cout << size.size() << '\n';
  sort(size.begin(), size.end());
  cout << size[0];
  for (int i = 1; i < size.size(); i++) cout << ' ' << size[i];
  cout << '\n';
  return 0;
}
