#include <bits/stdc++.h>
using namespace std;
void optimise() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
}
int mod = 1e9 + 7;
void normalize(int &a) { a = (a + mod) % mod; }
int modmul(int a, int b) {
  a = a % mod;
  b = b % mod;
  normalize(a);
  normalize(b);
  return (a * b) % mod;
}
int modadd(int a, int b) {
  a = a % mod;
  b = b % mod;
  normalize(a);
  normalize(b);
  return (a + b) % mod;
}
int modsub(int a, int b) {
  a = a % mod;
  b = b % mod;
  normalize(a);
  normalize(b);
  return (a - b + mod) % mod;
}
int me(int x, int n) {
  x %= mod;
  if (n == 0) return 1;
  int u = me(x, n / 2) % mod;
  u = (u * u) % mod;
  if (n % 2) u = (u * x) % mod;
  return u;
}
int me1(int x, int n) {
  if (n == 0) return 1;
  int u = me1(x, n / 2);
  u = u * u;
  if (n % 2) u = u * x;
  return u;
}
inline int modInv(int a) { return me(a, mod - 2); }
inline int modDiv(int a, int b) { return modmul(a, modInv(b)); }
int __gcd(int a, int b) {
  if (b == 0)
    return a;
  else
    return __gcd(b, a % b);
}
void solve() {
  int n;
  cin >> n;
  int vis[n + 1];
  memset(vis, 0, sizeof(vis));
  set<int> G[n + 1];
  int m;
  cin >> m;
  for (int i = 0; i < m; i++) {
    int x, y;
    cin >> x >> y;
    G[x].insert(y);
    G[y].insert(x);
  }
  set<int> v;
  for (int i = 1; i <= n; i++) {
    v.insert(i);
  }
  vector<int> ans1;
  while (v.size() > 0) {
    auto k1 = *v.begin();
    queue<int> q;
    q.push(k1);
    v.erase(k1);
    int ans = 1;
    while (!q.empty()) {
      int u = q.front();
      q.pop();
      vector<int> v1;
      for (auto y : v) {
        if (G[u].find(y) == G[u].end()) {
          v1.push_back(y);
          q.push(y);
          ans++;
        }
      }
      for (auto y : v1) {
        v.erase(y);
      }
    }
    ans1.push_back(ans);
  }
  cout << ans1.size() << "\n";
  sort(ans1.begin(), ans1.end());
  for (auto y : ans1) cout << y << " ";
}
signed main() {
  optimise();
  int t;
  t = 1;
  while (t--) {
    solve();
  }
}
