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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 int MAXN = 200010;
vector<int> G[MAXN];
int dist[MAXN];
queue<int> Q;
int MAGIC = MAXN * 2;
int bfs(int nod) {
  while (!Q.empty()) Q.pop();
  memset(dist, 0xFF, sizeof(dist));
  dist[nod] = 0;
  Q.push(nod);
  int mdist = 0, mnod = nod;
  while (!Q.empty()) {
    int t = Q.front();
    Q.pop();
    for (auto i = G[t].begin(), end = G[t].end(); i != end; ++i)
      if (dist[*i] == -1) {
        dist[*i] = dist[t] + 1;
        if (dist[*i] > mdist) {
          mdist = dist[*i];
          mnod = *i;
        }
        Q.push(*i);
      }
  }
  return mnod;
}
int diameter(int u) {
  u = bfs(u);
  int w = bfs(u);
  return dist[w];
}
set<pair<int, int> > S, SS;
int curMark = 0;
int vizitat[MAXN];
int compSz[MAXN];
void DFS(int x) {
  vizitat[x] = curMark;
  compSz[curMark]++;
  for (const auto &it : G[x])
    if (vizitat[it] != curMark) DFS(it);
}
int main() {
  int N, M;
  scanf("%d%d", &N, &M);
  for (int i = 0; i < M; ++i) {
    int a, b;
    scanf("%d%d", &a, &b);
    --a, --b;
    G[a].push_back(b);
    G[b].push_back(a);
    S.insert(make_pair(min(a, b), max(a, b)));
  }
  int u = bfs(0);
  for (int i = 0; i < N; ++i) {
    if (dist[i] < 0) {
      printf("%d\n%d\n", 1, N);
      return 0;
    }
  }
  int d = diameter(u);
  if (d >= 3) {
    printf("%d\n%d\n", 1, N);
    return 0;
  }
  for (int i = 0; i < N; ++i) G[i].clear();
  for (int i = 0; i < MAGIC; ++i) {
    int x = ((rand() << 15) | rand()) % N;
    int y = ((rand() << 15) | rand()) % N;
    if (x == y) continue;
    if (x > y) swap(x, y);
    if (S.count(make_pair(x, y))) continue;
    if (SS.count(make_pair(x, y))) continue;
    SS.insert(make_pair(x, y));
    G[x].push_back(y);
    G[y].push_back(x);
  }
  memset(vizitat, 0xFF, sizeof vizitat);
  for (int i = 0; i < N; ++i) {
    if (vizitat[i] >= 0) continue;
    DFS(i);
    ++curMark;
  }
  int mcomp = max_element(compSz, compSz + curMark) - compSz;
  int mcsz = compSz[mcomp];
  vector<int> ninComp;
  for (int i = 0; i < N; ++i) {
    if (vizitat[i] == mcomp) continue;
    bool flag = true;
    for (int j = 0; j < N && flag; ++j)
      if (vizitat[j] == mcomp && !S.count(make_pair(min(i, j), max(i, j))))
        flag = false;
    if (!flag) continue;
    ninComp.push_back(i);
  }
  N = ninComp.size();
  for (int i = 0; i < N; ++i) G[i].clear();
  for (int i = 0; i < N; ++i)
    for (int j = i + 1; j < N; ++j) {
      if (!S.count(make_pair(ninComp[i], ninComp[j])))
        G[i].push_back(j), G[j].push_back(i);
    }
  memset(vizitat, 0xFF, sizeof vizitat);
  curMark = 0;
  memset(compSz, 0, sizeof compSz);
  for (int i = 0; i < N; ++i) {
    if (vizitat[i] >= 0) continue;
    DFS(i);
    ++curMark;
  }
  compSz[curMark++] = mcsz;
  printf("%d\n", curMark);
  sort(compSz, compSz + curMark);
  for (int i = 0; i < curMark; ++i) printf("%d ", compSz[i]);
  puts("");
  return 0;
}
