#include <bits/stdc++.h>
using namespace std;
int parent[200100];
int c = 0;
int find_set(int x) {
  c++;
  if (parent[x] == x) {
    return x;
  } else {
    return find_set(parent[x]);
  }
}
int rnk[200100];
void union_set(int x, int y) {
  if (find_set(y) != find_set(x)) {
    int a = find_set(y);
    int b = find_set(x);
    if (rnk[a] < rnk[b]) {
      parent[a] = b;
    } else if (rnk[b] < rnk[a]) {
      parent[b] = a;
    } else {
      parent[a] = b;
      rnk[b]++;
    }
  }
}
int main() {
  int n, m;
  scanf("%d%d", &n, &m);
  for (int i = 0; i <= n; i++) {
    rnk[i] = 0;
  }
  for (int i = 1; i <= n; i++) {
    parent[i] = i;
  }
  parent[0] = 0;
  bool a[n + 2];
  if (n > 10000) {
    list<int> no_edge[n + 1];
    for (int i = 0; i < m; i++) {
      int x, y;
      scanf("%d%d", &x, &y);
      no_edge[x].push_back(y);
      no_edge[y].push_back(x);
    }
    for (int i = 1; i <= n; i++) {
      if (n - no_edge[i].size() >= 250000 / n + 2) {
        union_set(i, 0);
      } else {
        for (int j = 0; j <= n; j++) {
          a[j] = false;
        }
        for (int &j : no_edge[i]) {
          a[j] = true;
        }
        a[0] = true;
        for (int j = 1; j <= n; j++) {
          if (!a[j]) {
            union_set(i, j);
          }
        }
      }
    }
  } else {
    bool adj[n + 1][n + 1];
    for (int i = 1; i <= n; i++) {
      for (int j = 1; j <= n; j++) {
        adj[i][j] = true;
      }
    }
    for (int i = 0; i < m; i++) {
      int x, y;
      scanf("%d%d", &x, &y);
      adj[x][y] = false;
      adj[y][x] = false;
    }
    for (int i = 1; i <= n; i++) {
      for (int j = 1; j <= n; j++) {
        if (adj[i][j]) {
          union_set(i, j);
        }
      }
    }
  }
  int counter[n + 1];
  for (int i = 0; i <= n; i++) counter[i] = 0;
  for (int i = 1; i <= n; i++) {
    counter[find_set(i)]--;
  }
  sort(counter, counter + n + 1);
  int k = 0;
  while (counter[k] != 0) k++;
  printf("%d\n", k);
  for (int i = k - 1; i >= 0; i--) {
    printf("%d ", -counter[i]);
  }
  return 0;
}
