#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<ll> adj[200005];
ll group[200005];
vi cvis;
ll cmin;
bool vis[200005];
ll n, m;
ll ret[200005];
void dfs(ll x) {
  cvis.push_back(x);
  vis[x] = true;
  for (ll i = 0; i < n; i++) {
    if (x != i && adj[x].find(i) == adj[x].end()) {
      if (group[i] == 1) {
        cmin = 1;
        continue;
      } else {
        if (!vis[i]) {
          dfs(i);
        }
      }
    }
  }
}
signed main() {
  ll t = 1;
  while (t--) {
    cin >> n >> m;
    for (ll i = 0; i < m; i++) {
      ll a, b;
      cin >> a >> b;
      a--;
      b--;
      adj[a].insert(b);
      adj[b].insert(a);
    }
    ll cur = 1;
    for (ll i = 0; i < n; i++) {
      if (adj[i].size() < (n + 1) / 2) {
        group[i] = 1;
        ret[1]++;
        cur = 2;
      }
    }
    for (ll i = 0; i < n; i++) {
      if (!group[i]) {
        cmin = cur;
        dfs(i);
        for (ll j : cvis) {
          group[j] = cmin;
          ret[cmin]++;
        }
        cvis.clear();
        if (cmin != 1 || cur == 1) {
          cur++;
        }
      }
    }
    cout << cur - 1 << endl;
    sort(ret, ret + cur);
    for (ll i = 1; i < cur; i++) {
      cout << ret[i] << ' ';
    }
    cout << endl;
  }
}
