Problem: The only difference between easy and hard versions is constraints.

You are given n segments on the coordinate axis OX. Segments can intersect, lie inside each other and even coincide. The i-th segment is [l_i; r_i] (l_i ≤ r_i) and it covers all integer points j such that l_i ≤ j ≤ r_i.

The integer point is called bad if it is covered by strictly more than k segments.

Your task is to remove the minimum number of segments so that there are no bad points at all.

Input

The first line of the input contains two integers n and k (1 ≤ k ≤ n ≤ 200) — the number of segments and the maximum number of segments by which each integer point can be covered.

The next n lines contain segments. The i-th line contains two integers l_i and r_i (1 ≤ l_i ≤ r_i ≤ 200) — the endpoints of the i-th segment.

Output

In the first line print one integer m (0 ≤ m ≤ n) — the minimum number of segments you need to remove so that there are no bad points.

In the second line print m distinct integers p_1, p_2, ..., p_m (1 ≤ p_i ≤ n) — indices of segments you remove in any order. If there are multiple answers, you can print any of them.

Examples

Input


7 2
11 11
9 11
7 8
8 9
7 8
9 11
7 9


Output


3
1 4 7 


Input


5 1
29 30
30 30
29 29
28 30
30 30


Output


3
1 2 4 


Input


6 1
2 3
3 3
2 3
2 2
2 3
2 3


Output


4
1 3 5 6 

Solution (in JAVA):

Solution:
import java.io.*;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.*;
public class Main {

    public void sort(long b[]){
        Random rd = new Random();
        for(int i=1;i<b.length;++i){
            int c = rd.nextInt(i);
            long v = b[c];
            b[c] = b[i];
            b[i] = v;
        }
        Arrays.sort(b);
    }
    public void sort(int b[]){
        Random rd = new Random();
        for(int i = 1;i<b.length;++i){
            int c = rd.nextInt(i);
            int v = b[c];
            b[c]= b[i];
            b[i] = v;
        }
        Arrays.sort(b);
    }

    static int groups = 0;
    static int[] fa;
    static int[] sz;

    static void init(int n) {
        groups = n;
        fa = new int[n];
        for (int i = 1; i < n; ++i) {
            fa[i] = i;
        }
        sz = new int[n];
        Arrays.fill(sz, 1);
    }

    static int root(int p) {
        while (p != fa[p]) {
            fa[p] = fa[fa[p]];
            p = fa[p];
        }
        return p;
    }

    static void combine(int p, int q) {
        int i = root(p);
        int j = root(q);
        if (i == j) {
            return;
        }
        if (sz[i] < sz[j]) {
            fa[i] = j;
            sz[j] += sz[i];
        } else {
            fa[j] = i;
            sz[i] += sz[j];
        }
        groups--;
    }

    class Pair {
        long x;long y;
        Pair(long xx,long yy){
            x = xx;y= yy;
            long g = gcd(Math.abs(x),Math.abs(y));
            if(xx*yy>=0){
                x = Math.abs(x)/g;
                y = Math.abs(y)/g;
            }else{
                x = -Math.abs(x)/g;
                y = Math.abs(y)/g;
            }
        }

        public boolean equals(Object fk){
            Pair p = (Pair)fk;
            return x == p.x && y== p.y;
        }

        public int hashCode(){
            return (int)(x*37+y);
        }

    }

    void dfs(int g, List<Integer> go[],boolean vis[]){
        vis[g] = true;
        for(int u: go[g]){
            int to = u;
            if(!vis[to]) {
                dfs(to, go, vis);
            }
        }

    }

    public static void main(String[] args) throws Exception {
        new Main().run();}


    TreeMap<Integer,Integer> tmp = new TreeMap<>();

    void remove(int u){
        int v = tmp.get(u);
        if(v==1){
            tmp.remove(u);
        }else{
            tmp.put(u,v-1);
        }
    }


    void solve(){

        int n = ni();
        int k = ni();

        long tree[] = new long[2*100000+1];
        int l[ ] = new int[n];
        int r[ ] = new int[n];

        List<Integer> comin[] = new ArrayList[2*100000+1];
        List<Integer> leave[] = new ArrayList[2*100000+1];

        for(int i=0;i<2*100000+1;++i){
            comin[i] = new ArrayList<>();
            leave[i] = new ArrayList<>();
        }

        List<int[]> events = new ArrayList<>();


        boolean in[] = new boolean[2*100000+1];
        boolean ot[] = new boolean[2*100000+1];

        for(int i=0;i<n;++i){
            l[i] = ni();
            r[i] = ni()+1;
            in[l[i]] = true;
            ot[r[i]] = true;

//            events.add(new int[]{l[i],1});
//            events.add(new int[]{r[i],-1});
            comin[l[i]].add(i);
            leave[r[i]].add(i);
            update(tree, l[i], 1);
            update(tree, r[i], -1);
        }




        Set<Integer> opens = new HashSet<>();

        int res[] = new int[n];
        int p = 0;
        for(int u=0;u<2*100000+1;++u){
            if(ot[u]){
                for(int rm:leave[u]){
                    opens.remove(rm);
                }
            }
            if(!in[u])continue;
            for(int com:comin[u]){
                opens.add(com);
            }
           long sum = get(tree,u);
           if(sum>k){
               List<Integer> cur = new ArrayList<>(opens);
               Collections.sort(cur,(x,y)->{
                   return Integer.compare(r[y],r[x]);
               });
               for(int i=0;i<sum-k;++i){
                   int pos = cur.get(i);
                   opens.remove(pos);
                   res[p++] = pos;
                   update(tree, l[pos], -1);
                   update(tree, r[pos], 1);
               }
           }
        }
        println(p);
        for(int i=0;i<p;++i){
            print((1+res[i])+" ");
        }























//         PriorityQueue<int[]> q= new PriorityQueue<>((x,y)->{return x[0]-y[0];});
//
//         q.offer(new int[]{0,0});
//         boolean inq[] = new boolean[n];
//         while(q.size()>0){
//             int c[]= q.poll();
//             for(int i=h[c[1]];i!=-1;i=ne[i]){
//                 if(!inq[to[i]]) {
//                     q.offer(new int[]{ wt[i], to[i]});
//                     inq[to[i]] = true;
//                 }
//             }
//         }





    }


    int err = 0;



    void go(int rt,int pt,int fa) {
        stk[rt] = pt;
        for(int i=h[rt];i!=-1;i=ne[i]) {
            if(to[i]==pt||to[i]==fa) continue;
            go(to[i],pt,rt);
        }
    }



    int ct = 0;
    void add(int u,int v,int w,int q){
        to[ct] = v;
        wt[ct] = w;
        qt[ct] = q;
        ne[ct] = h[u];
        h[u] = ct++;
//
//        to1[ct] = u;
//        wt1[ct] = w;
//        ne1[ct] = h1[v];
//        h1[v] = ct++;
    }
    int []h,ne,to,wt,qt,stk;


    long inv(long a, long MOD) {
        //return fpow(a, MOD-2, MOD);
        return a==1?1:(long )(MOD-MOD/a)*inv(MOD%a, MOD)%MOD;
    }


    void inverse(){
        int MAXN = 10000;
        long inv[] = new long[MAXN+1];
        inv[1] = 1; //注意初始化
        long mod = 1000000007;
        for (int i=2; i<=MAXN; ++i) {
            inv[i] = (mod - mod / i) * inv[(int) (mod % i)] % mod;
        }
    }



    // 计算某个特别大的组合数
    long C(long n,long m, long MOD) {
        if(m+m>n)m=n-m;
        long up=1,down=1;
        for(long i=0;i<m;i++)
        {
            up=up*(n-i)%MOD;
            down=down*(i+1)%MOD;
        }
        return up*inv(down, MOD)%MOD;
    }


    void solve2() {

        int n = ni();
        String s=  ns();
        int g[][] = new int[3][3];
        for(int i = 0;i<n;++i){
            char c = s.charAt(i);
            int idx = 0;
            if(c=='G'){
                idx =1;
            }else if(c=='B'){
                idx =2;
            }
            g[c][i%3]++;
        }







    }































//    int []h,to,ne,wt;

    long t1[];
    //    long t2[];
    void update(long[] t,int i,long v){
        for(;i<t.length;i+=(i&-i)){
            t[i] += v;
        }
    }
    long get(long[] t,int i){
        long s = 0;
        for(;i>0;i-=(i&-i)){
            s += t[i];
        }
        return s;
    }

    int equal_bigger(long t[],long v){
        int s=0,p=0;
        for(int i=Integer.numberOfTrailingZeros(Integer.highestOneBit(t.length));i>=0;--i) {
            if(p+(1<<i)< t.length && s + t[p+(1<<i)] < v){
                v -= t[p+(1<<i)];
                p |= 1<<i;
            }
        }
        return p+1;
    }


    long gcd(long a,long b){ return b==0?a: gcd(b,a%b);}
    InputStream is;PrintWriter out;
    void run() throws Exception {is = System.in;
        //  is = new FileInputStream("C:\\Users\\Luqi\\Downloads\\P1600_2.in");

        out = new PrintWriter(System.out);solve();out.flush();}
    private byte[] inbuf = new byte[2];
    public int lenbuf = 0, ptrbuf = 0;
    private int readByte() {
        if (lenbuf == -1) throw new InputMismatchException();
        if (ptrbuf >= lenbuf) {
            ptrbuf = 0;
            try {lenbuf = is.read(inbuf);} catch (IOException e) {throw new InputMismatchException();}
            if (lenbuf <= 0) return -1;
        }
        return inbuf[ptrbuf++];}
    private boolean isSpaceChar(int c) {return !(c >= 33 && c <= 126);}
    private int skip() {int b;while((b = readByte()) != -1 && isSpaceChar(b));return b;}
    private double nd() {return Double.parseDouble(ns());}
    private char nc() {return (char) skip();}
    private char ncc() {int b;while((b = readByte()) != -1 && !(b >= 32 && b <= 126));return (char)b;}
    private String ns() {int b = skip();StringBuilder sb = new StringBuilder();
        while (!(isSpaceChar(b))) { // when nextLine, (isSpaceChar(b) && b != ' ')
            sb.appendCodePoint(b);b = readByte(); }
        return sb.toString();}
    private char[] ns(int n) {char[] buf = new char[n];int b = skip(), p = 0;
        while (p < n && !(isSpaceChar(b))) { buf[p++] = (char) b;b = readByte(); }
        return n == p ? buf : Arrays.copyOf(buf, p);}
    private String nline() {int b = skip();StringBuilder sb = new StringBuilder();
        while (!isSpaceChar(b) || b == ' ') { sb.appendCodePoint(b);b = readByte(); }
        return sb.toString();}
    private char[][] nm(int n, int m) {char[][] a = new char[n][];for (int i = 0; i < n; i++) a[i] = ns(m);return a;}
    private int[] na(int n) {int[] a = new int[n];for (int i = 0; i < n; i++) a[i] = ni();return a;}
    private long[] nal(int n) { long[] a = new long[n];for (int i = 0; i < n; i++) a[i] = nl();return a;}
    private int ni() { int num = 0, b; boolean minus = false;
        while ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-')){};
        if (b == '-') { minus = true; b = readByte(); }
        while (true) {
            if (b >= '0' && b <= '9') num = (num << 3) + (num << 1) + (b - '0');
            else return minus ? -num : num;
            b = readByte();}}
    private long nl() { long num = 0; int b;
        boolean minus = false;
        while ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-')){};
        if (b == '-') { minus = true; b = readByte(); }
        while (true) {
            if (b >= '0' && b <= '9')  num = num * 10 + (b - '0');
            else return minus ? -num : num;
            b = readByte();}}
    void print(Object obj){out.print(obj);}
    void println(Object obj){out.println(obj);}
    void println(){out.println();}
}