#include <bits/stdc++.h>
using namespace std;
int const N = 202000;
set<int> s;
set<int>::iterator it;
int edg[N];
vector<int> g[N];
int ans[N];
int cur = 1;
int vis[N];
void dfs(int node) {
  vis[node] = 1;
  ans[cur]++;
  vector<int> send;
  for (it = s.begin(); it != s.end();) {
    if (!binary_search(g[node].begin(), g[node].end(), *it)) {
      send.push_back(*it);
      s.erase(it++);
    } else
      it++;
  }
  for (int el : send) dfs(el);
}
int main() {
  int n, e;
  scanf("%d%d", &n, &e);
  for (int i = 1; i <= n; ++i) s.insert(i);
  for (int i = 0; i < e; ++i) {
    int temp, temp1;
    scanf("%d%d", &temp, &temp1);
    edg[temp]++;
    edg[temp1]++;
    g[temp].push_back(temp1);
    g[temp1].push_back(temp);
  }
  vector<pair<int, int>> go;
  for (int i = 1; i <= n; i++) {
    go.push_back(make_pair(edg[i], i));
    sort(g[i].begin(), g[i].end());
  }
  sort(go.begin(), go.end());
  for (auto el : go) {
    if (vis[el.second]) continue;
    s.erase(el.second);
    ans[0]++;
    dfs(el.second);
    cur++;
  }
  cout << ans[0] << "\n";
  sort(ans + 1, ans + ans[0] + 1);
  for (int i = 1; i <= ans[0]; i++) {
    cout << ans[i] << " ";
  }
  return 0;
}
