#include <bits/stdc++.h>   using namespace std;   int n, m, a, b;   set<pair<int, int> > s;   set<int> sc;   vector<int> ans;   int main() {     cin >> n >> m;     for (int i = 1; i <= m; ++i) {       cin >> a >> b;       s.insert(make_pair(min(a, b), max(a, b)));     }     for (int i = 1; i <= n; ++i) {       sc.insert(i);     }     for (int i = 1; i <= n; ++i) {       if (sc.find(i) != sc.end()) {         int cur = 0;         queue<int> q;         q.push(i);         sc.erase(i);         while (!q.empty()) {           cur++;           int v = q.front();           q.pop();           set<int>::iterator it;           set<int> c = sc;           for (it = c.begin(); it != c.end(); it++) {             int to = *it;             if (s.find(make_pair(min(v, to), max(v, to))) == s.end()) {               q.push(to);               sc.erase(to);             }           }         }         ans.push_back(cur);       }     }     sort(ans.begin(), ans.end());     cout << (int)ans.size() << endl;     for (int i = 0; i < (int)ans.size(); ++i) {       cout << ans[i] <<    ;     }     cout << endl;     return 0;   }   