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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 

// {{{ ==== header ====
#include <bits/stdc++.h>

#define rep_(i, n) for (int i = 0; i < int(n); ++i)
#define for_(i, a, b) for (int i = int(a); i <= int(b); ++i)
#define sz_(x) (int((x).size()))
#define all_(x) begin(x), end(x)

using namespace std;

namespace { namespace aimi {

template<class T> void _input(T &x) { cin >> x; }
void _input(int &x) { scanf("%d", &x); }
void _input(int64_t &x) { scanf("%" SCNd64, &x); }
void _input(double &x) { scanf("%lf", &x); }
void _input(char &x) { scanf(" %c", &x); }
void _input(char *x) { scanf("%s", x); }
void input() {}
void input(char *x) { scanf("%s", x); }
template<class T, class... U> void input(T &head, U &... tail) { _input(head); input(tail...); }

template<class T> void _print(const T &x) { cout << x; }
void _print(const int &x) { printf("%d", x); }
void _print(const int64_t &x) { printf("%" PRId64, x); }
void _print(const double &x) { printf("%.16f", x); }
void _print(const char &x) { putchar(x); }
void _print(const char *x) { printf("%s", x); }
template<class T> void _print(const vector<T> &x) { for (auto i = cbegin(x); i != cend(x); _print(*i++)) if (i != cbegin(x)) putchar(' '); }
void print() {}
template<class T, class... U> void print(const T &head, const U &... tail) { _print(head); putchar(sizeof...(tail) ? ' ' : '\n'); print(tail...); }

#ifdef LOCAL_TEST
#include "local_test.hpp"
#else
#define dump(...)
#endif

template<class T, class F = less<T>> void sort_unique(vector<T> &v, F f = F()) { sort(all_(v), f); v.resize(unique(all_(v)) - begin(v)); }
template<class T> inline T get_bit(T x, int i) { return (x >> i) & 1; }
template<class T> inline bool chkmax(T &a, const T &b) { return b > a ? a = b, true : false; }
template<class T> inline bool chkmin(T &a, const T &b) { return b < a ? a = b, true : false; }
template<class T> using MaxHeap = priority_queue<T>;
template<class T> using MinHeap = priority_queue<T, vector<T>, greater<T>>;
// }}}

// {{{ ==== disjoint set ====
struct DisjointSet {
    vector<int> fa, sz;
    //TODO: operator []
    void init(int n) {
        ++n;  // capable for 1-indexed
        fa.resize(n);
        sz.resize(n);
        for (int i = 0; i < n; ++i) sz[fa[i] = i] = 1;
    }
    int root(int x) {
        return (x == fa[x]) ? x : fa[x] = root(fa[x]);
    }
    void merge(int a, int b) {  // a->b
        a = root(a); b = root(b);
        if (a == b) return;
        if (sz[a] > sz[b]) swap(a, b);
        fa[a] = b;
        sz[b] += sz[a];
    }
} djs;
// }}}

const int MAX = 200005;

int n, m;
unordered_set<int> ie[MAX];

void main() {
    input(n, m);
    rep_(i, m) {
        int x, y;
        input(x, y);
        ie[x].insert(y);
        ie[y].insert(x);
    }
    vector<int> ord;
    for_(i, 1, n) ord.push_back(i);
    random_shuffle(all_(ord));
    const int n_rep = min(n, 40000000 / n);
    djs.init(n);
    int ptr = 0;
    for_(i, 1, n) {
        //if (djs.root(i) != i) continue;
        //for_(j, 1, n) {
        rep_(k, n_rep) {
            const int j = ord[ptr++];
            if (ptr == n) ptr = 0;
            if (ie[i].find(j) != ie[i].end()) continue;
            djs.merge(j, i);
        }
    }
    map<int, int> cnt;
    for_(i, 1, n) {
        cnt[djs.root(i)]++;
    }
    vector<int> ans;
    for (const auto& p : cnt) {
        ans.push_back(p.second);
    }
    sort(all_(ans));
    print(sz_(ans));
    print(ans);
}

// {{{ ==== execution ====
}}

int main() { aimi::main(); return 0; }
// }}}
