#include <bits/stdc++.h>
using namespace std;
int main(int argc, char **argv) {
  map<pair<long long, long long>, bool> mp;
  long long n, m;
  cin >> n >> m;
  for (long long i = 0; i < m; i++) {
    long long u, v;
    cin >> u >> v;
    mp[make_pair(u, v)]++;
    mp[make_pair(v, u)]++;
  }
  vector<long long> vresp;
  deque<long long> dq;
  while (n) {
    dq.push_back(n--);
  }
  while (!dq.empty()) {
    long long c = 1, p = dq.front();
    dq.pop_front();
    queue<long long> q;
    q.push(p);
    while (!q.empty()) {
      long long x = dq.size();
      p = q.front();
      q.pop();
      while (x--) {
        long long xx = dq.front();
        dq.pop_front();
        if (mp[make_pair(p, xx)]) {
          dq.push_back(xx);
        } else {
          q.push(xx);
          c++;
        }
      }
    }
    vresp.push_back(c);
  }
  cout << vresp.size() << endl;
  sort(vresp.begin(), vresp.end());
  for (auto T : vresp) cout << T << " ";
  cout << endl;
  return 0;
}
