#include <bits/stdc++.h>
using namespace std;
map<int, bool> mp[200007];
set<int> st;
vector<int> ans2;
int main() {
  int n, m, i, j, k, x, y;
  scanf("%d%d", &n, &m);
  for (i = 1; i <= m; i++) {
    scanf("%d%d", &x, &y);
    mp[x][y] = 1;
    mp[y][x] = 1;
  }
  st.clear();
  for (i = 1; i <= n; i++) {
    st.insert(i);
  }
  set<int>::iterator it;
  while (!st.empty()) {
    vector<int> ans;
    it = st.begin();
    st.erase(it);
    queue<int> q;
    while (!q.empty()) q.pop();
    q.push(*it);
    ans.push_back(*it);
    while (!q.empty()) {
      x = q.front();
      q.pop();
      for (it = st.begin(); it != st.end();) {
        if (!mp[x][*it]) {
          ans.push_back(*it);
          q.push(*it);
          st.erase(it++);
        } else
          it++;
      }
    }
    ans2.push_back(ans.size());
  }
  printf("%d\n", ans2.size());
  sort(ans2.begin(), ans2.end());
  for (i = 0; i < ans2.size(); i++) {
    if (i > 0) printf(" ");
    printf("%d", ans2[i]);
  }
  printf("\n");
  return 0;
}
