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

import java.io.*;
import java.math.BigInteger;
import java.util.*;
import java.util.concurrent.atomic.AtomicIntegerArray;

public class Solution {

    public static void main(String[] args) throws Exception {
        MyReader reader = new MyReader(System.in);
//        MyReader reader = new MyReader(new FileInputStream("input.txt"));
        MyWriter writer = new MyWriter(System.out);
        new Solution().run(reader, writer);
        writer.close();
    }

    private void run(MyReader reader, MyWriter writer) throws Exception {
        int n = reader.nextInt();
        int m = reader.nextInt();
        Set<Integer>[] edges = new Set[n];
        for (int i = 0; i < n; i++) {
            edges[i] = new HashSet<>();
        }
        for (int i = 0; i < m; i++) {
            int a = reader.nextInt() - 1;
            int b = reader.nextInt() - 1;
            edges[a].add(b);
            edges[b].add(a);
        }
        List<Integer> ans = new ArrayList<>();
        int q = 0;
        for (int i = 1; i < n; i++) {
            if (edges[i].size() < edges[q].size()) {
                q = i;
            }
        }
        for (int i = 0; i < n; i++) {
            if (edges[q].contains(i)) {
                nvis.add(i);
            }
        }
        vis.add(q);
        for (int i = 0; i < n; i++) {
            if (!edges[q].contains(i)) {
                dfs(i, edges);
            }
        }
        ans.add(vis.size());
        for (int i = 0; i < n; i++) {
            if (!vis.contains(i)) {
                q = vis.size();
                dfs(i, edges);
                ans.add(vis.size() - q);
            }
        }
        System.out.println(ans.size());
        ans.sort(Comparator.naturalOrder());
        for (int qq : ans) {
            System.out.print(qq + " ");
        }
    }


    private Set<Integer> vis = new HashSet<>();
    private List<Integer> nvis = new ArrayList<>();

    private void dfs(int n, Set<Integer>[] edges) {
        vis.add(n);
        for (int q : nvis) {
            if (!vis.contains(q) && !edges[n].contains(q)) {
                dfs(q, edges);
            }
        }
    }

static class MyReader {

    final BufferedInputStream in;
    final int bufSize = 1 << 16;
    final byte buf[] = new byte[bufSize];
    int i = bufSize;
    int k = bufSize;
    boolean end = false;
    final StringBuilder str = new StringBuilder();

    MyReader(InputStream in) {
        this.in = new BufferedInputStream(in, bufSize);
    }

    int nextInt() throws IOException {
        return (int) nextLong();
    }

    int[] nextIntArray(int n) throws IOException {
        int[] m = new int[n];
        for (int i = 0; i < n; i++) {
            m[i] = nextInt();
        }
        return m;
    }

    int[][] nextIntMatrix(int n, int m) throws IOException {
        int[][] a = new int[n][0];
        for (int j = 0; j < n; j++) {
            a[j] = nextIntArray(m);
        }
        return a;
    }

    long nextLong() throws IOException {
        int c;
        long x = 0;
        boolean sign = true;
        while ((c = nextChar()) <= 32) ;
        if (c == '-') {
            sign = false;
            c = nextChar();
        }
        if (c == '+') {
            c = nextChar();
        }
        while (c >= '0') {
            x = x * 10 + (c - '0');
            c = nextChar();
        }
        return sign ? x : -x;
    }

    long[] nextLongArray(int n) throws IOException {
        long[] m = new long[n];
        for (int i = 0; i < n; i++) {
            m[i] = nextLong();
        }
        return m;
    }

    int nextChar() throws IOException {
        if (i == k) {
            k = in.read(buf, 0, bufSize);
            i = 0;
        }
        return i >= k ? -1 : buf[i++];
    }

    String nextString() throws IOException {
        if (end) {
            return null;
        }
        str.setLength(0);
        int c;
        while ((c = nextChar()) <= 32 && c != -1) ;
        if (c == -1) {
            end = true;
            return null;
        }
        while (c > 32) {
            str.append((char) c);
            c = nextChar();
        }
        return str.toString();
    }

    String nextLine() throws IOException {
        if (end) {
            return null;
        }
        str.setLength(0);
        int c = nextChar();
        while (c != '\n' && c != '\r' && c != -1) {
            str.append((char) c);
            c = nextChar();
        }
        if (c == -1) {
            end = true;
            if (str.length() == 0) {
                return null;
            }
        }
        if (c == '\r') {
            nextChar();
        }
        return str.toString();
    }

    char[] nextCharArray() throws IOException {
        return nextString().toCharArray();
    }

    char[][] nextCharMatrix(int n) throws IOException {
        char[][] a = new char[n][0];
        for (int i = 0; i < n; i++) {
            a[i] = nextCharArray();
        }
        return a;
    }
}

static class MyWriter {

    final BufferedOutputStream out;
    final int bufSize = 1 << 16;
    final byte buf[] = new byte[bufSize];
    int i = 0;
    final byte c[] = new byte[30];
    static final String newLine = System.getProperty("line.separator");

    MyWriter(OutputStream out) {
        this.out = new BufferedOutputStream(out, bufSize);
    }

    void print(long x) throws IOException {
        int j = 0;
        if (i + 30 >= bufSize) {
            flush();
        }
        if (x < 0) {
            buf[i++] = (byte) ('-');
            x = -x;
        }
        while (j == 0 || x != 0) {
            c[j++] = (byte) (x % 10 + '0');
            x /= 10;
        }
        while (j-- > 0)
            buf[i++] = c[j];
    }

    void print(int[] m) throws IOException {
        for (int a : m) {
            print(a);
            print(' ');
        }
    }

    void print(long[] m) throws IOException {
        for (long a : m) {
            print(a);
            print(' ');
        }
    }

    void print(String s) throws IOException {
        for (int i = 0; i < s.length(); i++) {
            print(s.charAt(i));
        }
    }

    void print(char x) throws IOException {
        if (i == bufSize) {
            flush();
        }
        buf[i++] = (byte) x;
    }

    void print(char[] m) throws IOException {
        for (char c : m) {
            print(c);
        }
    }

    void println(String s) throws IOException {
        print(s);
        println();
    }

    void println() throws IOException {
        print(newLine);
    }

    void flush() throws IOException {
        out.write(buf, 0, i);
        out.flush();
        i = 0;
    }

    void close() throws IOException {
        flush();
        out.close();
    }
}
}