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 8
7 9
7 10
7 11
7 12
8 9
8 10
8 11
9 10
9 11
9 12
10 12
 4 3
2 1
3 1
4 2
 3 1
2 3
 6 10
1 2
1 3
1 4
1 6
2 3
2 4
2 5
3 5
3 6
4 6
 11 49
10 3
6 4
11 3
7 6
10 6
6 1
4 3
10 2
4 5
9 2
10 1
5 7
1 5
9 7
2 11
8 6
3 9
2 5
9 5
6 5
1 4
11 9
1 7
8 10
3 6
3 7
11 5
6 9
4 10
8 7
4 9
8 2
4 2
8 11
7 4
9 10
8 1
10 7
3 2
5 8
8 9
1 3
2 7
10 11
5 3
10 5
4 11
1 11
8 3
 5 4
1 4
2 3
4 3
4 2
 4 3
1 2
3 1
4 3
 4 3
1 3
1 4
2 3
 10 36
7 8
7 9
2 3
2 4
2 5
9 10
2 7
2 8
2 9
2 10
4 5
4 6
4 7
4 8
4 10
6 7
6 9
6 10
1 2
1 3
1 4
8 9
1 5
8 10
1 7
1 8
1 9
1 10
3 4
3 6
3 7
3 9
5 6
5 7
5 9
5 10
 8 15
2 1
4 5
2 4
3 4
2 5
3 5
2 6
3 6
5 6
4 6
2 7
3 8
2 8
3 7
6 7

3
1 2 4 
 3
1 2 5 
 2
1 3 
 1
8 
 1
10 
 2
1 4 
 1
2 
 3
1 3 4 
 2
1 1 
 1
6 
 3
1 4 7 
 4
1 1 1 9 
 1
4 
 1
3 
 1
6 
 5
1 1 1 2 6 
 1
5 
 1
4 
 1
4 
 2
2 8 
 1
8 

#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
long long read() {
  long long x = 0, f = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = x * 10 + ch - '0';
    ch = getchar();
  }
  return x * f;
}
void write(long long x) {
  if (x < 0) x = -x, putchar('-');
  if (x >= 10) write(x / 10);
  putchar(x % 10 + '0');
}
long long quickmod(long long x, long long y) {
  long long Ans = 1;
  while (y) {
    if (y & 1) Ans = (Ans * x) % mod;
    x = (x * x) % mod;
    y >>= 1;
  }
  return Ans;
}
struct st {
  long long v, e, id;
  st() {}
  st(long long A, long long B, long long C) { v = A, e = B, id = C; }
};
vector<st> G[200005];
long long fa[200005], siz[200005];
void makeSet(long long x) {
  for (long long i = 1; i <= x; i++) fa[i] = i, siz[i] = 1;
}
long long findSet(long long x) {
  if (x == fa[x]) return x;
  fa[x] = findSet(fa[x]);
  return fa[x];
}
long long tot = 0;
struct Edge {
  long long u, v, e;
} q[1000005];
bool cmp(Edge A, Edge B) { return A.e < B.e; }
long long vis[200005], vis2[200005];
vector<long long> V;
signed main() {
  long long n = read(), m = read();
  long long sum = 0;
  for (long long i = 1; i <= m; i++) {
    long long u = read(), v = read();
    long long e = 0;
    sum ^= e;
    G[u].push_back(st(v, e, i));
    G[v].push_back(st(u, e, i));
  }
  long long Ans = n;
  long long pl = 1;
  for (long long i = 1; i <= n; i++)
    if (G[i].size() < G[pl].size()) pl = i;
  makeSet(n);
  for (long long i = 0; i < (long long)G[pl].size(); i++) vis[G[pl][i].v] = 1;
  for (long long i = 1; i <= n; i++) {
    if (vis[i] == 0) {
      if (findSet(i) != findSet(pl))
        siz[findSet(pl)] += siz[findSet(i)], fa[findSet(i)] = findSet(pl),
                                             Ans--;
    }
  }
  for (long long i = 1; i <= n; i++) {
    if (vis[i]) {
      for (long long j = 0; j < (long long)G[i].size(); j++)
        vis2[G[i][j].v] = 1;
      for (long long j = 1; j <= n; j++) {
        if (vis2[j] == 0 && findSet(i) != findSet(j)) {
          fa[findSet(i)] = findSet(j);
          siz[findSet(j)] += siz[findSet(i)];
          Ans--;
          tot++;
          q[tot].u = i, q[tot].v = j, q[tot].e = 0;
        }
      }
      for (long long j = 0; j < (long long)G[i].size(); j++)
        vis2[G[i][j].v] = 0;
    }
  }
  memset(vis, 0, sizeof vis);
  printf("%lld\n", Ans);
  for (long long i = 1; i <= n; i++) {
    if (vis[findSet(i)] == 0) {
      vis[findSet(i)] = 1;
      V.push_back(siz[findSet(i)]);
    }
  }
  sort(V.begin(), V.end());
  for (long long i = 0; i < V.size(); i++) printf("%lld ", V[i]);
  return 0;
}
