#include <bits/stdc++.h>
using namespace std;
long long n, m;
long long lit = 2000;
long long enough = 200;
vector<vector<long long> > rev(200500), con(200500);
vector<long long> color(200500, 0);
vector<bool> used(200500, false);
bool a[2002][2002];
void dfs(long long start, long long c) {
  used[start] = true;
  color[start] = c;
  for (long long i = 1; i <= n; i++) {
    if ((a[start][i]) && (!used[i]) && (color[i] == 0)) {
      dfs(i, c);
    }
  }
}
void dfs2(long long start, long long c) {
  used[start] = true;
  color[start] = c;
  for (long long i = 0; i < con[start].size(); i++) {
    long long Next = con[start][i];
    if ((!used[Next]) && (color[Next] == 0))
      dfs2(Next, c);
    else if (!used[Next] && color[Next] != 0 && color[Next] != c) {
      for (long long j = 1; j <= n; j++)
        if (color[j] == c) color[j] = color[Next];
    }
  }
}
int main() {
  cin >> n >> m;
  long long i, j;
  if (n <= lit) {
    for (i = 1; i <= n; i++) {
      for (j = 1; j <= n; j++) {
        a[i][j] = true;
      }
    }
    for (i = 0; i < m; i++) {
      long long q, w;
      cin >> q >> w;
      a[q][w] = false;
      a[w][q] = false;
    }
    long long cl = 0;
    for (i = 1; i <= n; i++) {
      if (color[i] == 0) {
        cl++;
        dfs(i, cl);
      }
    }
    cout << cl << endl;
    vector<long long> rez(cl + 1, 0);
    for (i = 1; i <= n; i++) {
      rez[color[i]]++;
    }
    sort(rez.begin() + 1, rez.end());
    for (i = 1; i < rez.size(); i++) cout << rez[i] << " ";
    return 0;
  }
  for (i = 0; i < m; i++) {
    long long q, w;
    cin >> q >> w;
    rev[q].push_back(w);
    rev[w].push_back(q);
  }
  long long col = 1;
  for (i = 1; i <= n; i++) {
    if (rev[i].size() < enough) color[i] = 1;
  }
  for (i = 1; i <= n; i++) {
    if (rev[i].size() >= enough) {
      vector<long long> temp(n + 2, 1);
      temp[i] = 0;
      for (j = 0; j < rev[i].size(); j++) {
        long long cur = rev[i][j];
        temp[cur] = 0;
      }
      for (j = 1; j <= n; j++) {
        if (temp[j]) {
          if (color[j] == 1) {
            color[i] = 1;
            con[i].clear();
            break;
          } else
            con[i].push_back(j);
        }
      }
    }
  }
  for (i = 1; i <= n; i++) {
    if (rev[i].size() == n - 1 && (color[i] == 0)) {
      col++;
      color[i] = col;
    } else if (rev[i].size() == 0) {
      cout << 1 << endl;
      cout << n;
      return 0;
    } else if ((rev[i].size() >= enough) && (color[i] == 0)) {
      col++;
      dfs2(i, col);
    }
  }
  bool need = false;
  for (i = 1; i <= n; i++) {
    if (color[i] == 0) need = true;
  }
  if (need) {
    col++;
    for (i = 1; i <= n; i++)
      if (color[i] == 0) color[i] = col;
  }
  vector<long long> ans(col + 1, 0);
  for (i = 1; i <= n; i++) {
    ans[color[i]]++;
  }
  sort(ans.begin() + 1, ans.end());
  long long cnt = 0;
  for (i = 1; i < ans.size(); i++)
    if (ans[i] > 0) cnt++;
  cout << cnt << endl;
  for (i = 1; i < ans.size(); i++)
    if (ans[i] > 0) cout << ans[i] << " ";
  return 0;
}
