#include <bits/stdc++.h>
using namespace std;
map<pair<int, int>, int> edge;
set<int> unvis;
vector<int> con;
int dfs(int x) {
  int ans = 1;
  unvis.erase(x);
  int y = 1;
  while (1) {
    set<int>::iterator it = unvis.upper_bound(y);
    if (it == unvis.end()) break;
    y = *it;
    if (edge[{x, y}] || edge[{y, x}]) continue;
    ans += dfs(y);
  }
  return ans;
}
int main() {
  ios_base::sync_with_stdio(0);
  ;
  cin.tie(0);
  cout.tie(0);
  int i, j, x, y, n, m;
  cin >> n >> m;
  for (i = 0; i < m; i++) {
    cin >> x >> y;
    edge[{x, y}] = edge[{y, x}] = 1;
  }
  for (i = 1; i < n + 1; i++) unvis.insert(i);
  for (i = 1; i < n + 1; i++) {
    if (unvis.find(i) != unvis.end()) con.push_back(dfs(i));
  }
  sort(con.begin(), con.end());
  cout << con.size() << "\n";
  for (i = 0; i < con.size(); i++) cout << con[i] << " ";
  return 0;
}
