#include <bits/stdc++.h>
using namespace std;
const int N = 3e5 + 7;
int n, m;
set<int> valid;
vector<int> g[N];
vector<int> par;
int findpar(int u) {
  if (par[u] == u) return u;
  return par[u] = findpar(par[u]);
}
void add(int x, int y) { par[findpar(x)] = findpar(y); }
int main() {
  std ::ios ::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> m;
  par.resize(n + 1);
  for (int i = 1; i <= n; ++i) {
    valid.insert(i);
    par[i] = i;
  }
  for (int i = 1; i <= m; ++i) {
    int x, y;
    cin >> x >> y;
    g[x].emplace_back(y);
    g[y].emplace_back(x);
  }
  for (int i = 1; i <= n; ++i) {
    sort(g[i].begin(), g[i].end());
  }
  priority_queue<int, vector<int>, greater<int> > out;
  for (int i = 1; i <= n; ++i) {
    int ans = 0;
    if (valid.count(i)) {
      queue<int> Q;
      queue<int> cut;
      Q.emplace(i);
      valid.erase(i);
      while (!Q.empty()) {
        int from = Q.front();
        ++ans;
        Q.pop();
        for (auto s : valid) {
          if (!binary_search(g[from].begin(), g[from].end(), s)) {
            Q.emplace(s);
            cut.emplace(s);
            add(s, from);
          }
        }
        while (!cut.empty()) {
          valid.erase(cut.front());
          cut.pop();
        }
      }
      out.emplace(ans);
    }
  }
  cout << out.size() << '\n';
  while (!out.empty()) {
    cout << out.top() << ' ';
    out.pop();
  }
  cout << '\n';
  return 0;
}
