#include <bits/stdc++.h>
using namespace std;
const long long OO = 1e8;
const long long OOL = 1e16;
const long long MOD = 1e9 + 7;
const double EPS = 1e-9;
unsigned long long gcd(unsigned long long a, unsigned long long b) {
  return (b == 0 ? a : gcd(b, a % b));
}
unsigned long long lcm(unsigned long long a, unsigned long long b) {
  return (a * (b / gcd(a, b)));
}
long long N, K;
set<int> s;
void printVec(vector<long long> v2) {
  for (int i = 0; i < (int)v2.size(); ++i) cout << v2[i] << " ";
  cout << endl;
}
long long M;
map<pair<int, int>, bool> m;
bool visited[200001] = {false};
long long nb = 0;
vector<int> suppme;
void f(int i) {
  if (visited[i] == true) return;
  visited[i] = true;
  nb++;
  bool ok = false;
  set<int>::iterator it1 = s.begin();
  while (it1 != s.end()) {
    if (*it1 != i && m[make_pair(i, *it1)] != 1 && m[make_pair(*it1, i)] != 1) {
      ok = true;
      int tmp = *it1;
      s.erase(it1);
      f(tmp);
      it1 = s.upper_bound(tmp);
    } else
      it1++;
  }
  if (!ok) s.erase(i);
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cin >> N >> M;
  int x, y;
  memset(visited, false, 200001);
  while (M--) {
    cin >> x >> y;
    m[make_pair(x - 1, y - 1)] = 1;
  }
  vector<long long> res;
  for (int i = N - 1; i >= 0; i--) s.insert(i);
  set<int>::iterator it = s.begin();
  while (it != s.end()) {
    nb = 0;
    f(*it);
    if (nb != 0) res.push_back(nb);
    it = s.begin();
  }
  cout << res.size() << endl;
  sort(res.begin(), res.end());
  printVec(res);
  return 0;
}
