#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<long long>;
using vpi = vector<pair<ll, ll>>;
using pi = pair<ll, ll>;
const int mod = 1000000007;
set<int> adj[200000];
set<int> unvis;
int group[200000];
int cur = 0;
void dfs(int x) {
  group[cur]++;
  auto it = unvis.begin();
  while (it != unvis.end()) {
    assert(!unvis.empty());
    if (adj[x].count(*it)) {
      it++;
    } else {
      int last = *it;
      unvis.erase(it);
      dfs(*it);
      it = unvis.upper_bound(last);
    }
  }
}
int main() {
  int tt = 1;
  while (tt--) {
    int n, m;
    cin >> n >> m;
    for (int i = 0; i < m; i++) {
      int a, b;
      cin >> a >> b;
      a--;
      b--;
      adj[a].insert(b);
      adj[b].insert(a);
    }
    for (int i = 0; i < n; i++) {
      unvis.insert(i);
    }
    for (int i = 0; i < n; i++) {
      auto it = unvis.find(i);
      if (it != unvis.end()) {
        unvis.erase(it);
        dfs(i);
        cur++;
      }
    }
    cout << cur << endl;
    sort(group, group + cur);
    for (int i = 0; i < cur; i++) {
      cout << group[i] << ' ';
    }
    cout << endl;
  }
}
