#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 9;
int n, m, x, y, c;
vector<int> ans;
set<int> s;
map<int, int> g[N];
void dfs(int x) {
  queue<int> q;
  c = 0;
  q.push(x);
  while (q.size()) {
    int u = q.front();
    c++;
    q.pop();
    vector<int> o;
    for (auto v : s)
      if (!g[u][v]) {
        q.push(v);
        o.push_back(v);
      }
    for (int i = 0; i < o.size(); i++) s.erase(o[i]);
  }
}
int main() {
  cin >> n >> m;
  for (int i = 0; i < m; i++) {
    cin >> x >> y;
    g[x][y] = 1;
    g[y][x] = 1;
  }
  for (int i = 0; i < n; i++) s.insert(i + 1);
  while (s.size()) {
    x = *s.begin();
    s.erase(x);
    dfs(x);
    ans.push_back(c);
  }
  sort(ans.begin(), ans.end());
  cout << ans.size() << endl;
  for (int i = 0; i < ans.size(); i++) cout << ans[i] << " ";
  cout << endl;
  ;
}
