#include <bits/stdc++.h>
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace std;
int64_t mod = 1e9 + 7;
int64_t mod1 = 1e9 + 5;
int64_t power(int64_t a, int64_t b) {
  if (b == 0)
    return 1;
  else if (b % 2 == 0)
    return power((((a % mod) * (a % mod)) % mod), b / 2) % mod;
  else
    return ((a % mod) * (power((((a % mod) * (a % mod)) % mod), b / 2) % mod)) %
           mod;
}
unordered_set<int64_t> v[200001];
bool vis[200001];
int64_t sz;
int64_t n, m;
unordered_set<int64_t> s;
unordered_set<int64_t> s1;
void dfs(int64_t u) {
  vis[u] = true;
  vector<int64_t> te;
  for (auto it = s.begin(); it != s.end(); ++it) {
    if (v[u].find(*it) == v[u].end() and vis[*it] == false) {
      te.push_back(*it);
    }
  }
  for (int64_t i = 0; i < te.size(); ++i) {
    s.erase(te[i]);
  }
  for (int64_t i = 0; i < te.size(); ++i) dfs(te[i]), sz++;
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  cin >> n >> m;
  for (int64_t i = 0; i < m; ++i) {
    int64_t a, b;
    cin >> a >> b;
    v[a].insert(b);
    v[b].insert(a);
  }
  memset(vis, false, sizeof(vis));
  int64_t ans = 0;
  for (int64_t i = 1; i <= n; ++i) s.insert(i);
  vector<int64_t> fin;
  for (int64_t i = 1; i <= n; ++i) {
    if (vis[i] == false) {
      sz = 0;
      dfs(i), ans++;
      fin.push_back(sz);
    }
  }
  cout << ans << '\n';
  sort(fin.begin(), fin.end());
  for (int64_t i = 0; i < fin.size(); ++i) cout << fin[i] + 1 << " ";
}
