cin >> n >> m; for (int i = 1; i <= m; ++i) { int x, y; cin >> x >> y; G[x].push_back(y); G[y].push_back(x); ++du[x]; ++du[y]; } int p = min_element(du + 1, du + n + 1) - du; init_fa(n); vector<int> vec; fill(vis + 1, vis + n + 1, 1); for (auto v : G[p]) vis[v] = 0; for (int u = 1; u <= n; ++u) if (!vis[u]) vec.push_back(u); else merge(u, p); for (int u = 1; u <= n; ++u) { if (vis[u]) continue; for (auto v : G[u]) use[v] = 1; for (int v = 1; v <= n; ++v) if (!use[v]) merge(u, v); for (auto v : G[u]) use[v] = 0; } vector<int> ans, cnt(n + 1); for (int i = 1; i <= n; ++i) ++cnt[find(i)], find(i) == i && (ans.push_back(i), 0); cout << ans.size() << "\n"; sort(ans.begin(), ans.end(), [&](constint &u, constint &v) { return cnt[u] < cnt[v]; }); for (auto t : ans) cout << cnt[t] << " "; cout << "\n"; return0; }