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.BufferedReader;
import java.io.BufferedWriter;
import java.io.EOFException;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.math.BigInteger;
import java.io.ObjectInputStream.GetField;
import java.security.KeyStore.Entry;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.PriorityQueue;
import java.util.Queue;
import java.util.Stack;
import java.util.StringTokenizer;
import java.util.TreeMap;
import java.util.TreeSet;

import javax.annotation.processing.RoundEnvironment;

public class codeforcesreturn {
	public static class Pair implements Comparable<Pair> {
		int start;
		int end;
		int idx;
		public Pair(int start, int end,int idx) {
			super();
			this.start = start;
			this.end = end;
			this.idx=idx;
		}

		@Override
		public String toString() {
			return "Pair [start=" + start + ", end=" + end + ", idx=" + idx + "]";
		}

		@Override
		public int compareTo(Pair p) {
			if (start == p.start)
				return end - p.end;
			return start - p.start;
		}

	}
	public static class edge implements Comparable<edge> {
		int start;
		int end;
		int idx;
		public edge(int start, int end,int idx) {
			super();
			this.start = start;
			this.end = end;
			this.idx=idx;
		}

		@Override
		public String toString() {
			return "edge [start=" + start + ", end=" + end + ", idx=" + idx + "]";
		}

		@Override
		public int compareTo(edge e) {
			if(end==e.end)
				return idx-e.idx;
			return e.end - end;
		}

	}


	public static class UnionFind {
		int[] p, rank;
		boolean[] cyclic;

		public UnionFind(int N) {
			p = new int[N];
			rank = new int[N];
			// cyclic = new boolean[N];
			for (int i = 0; i < N; i++)
				p[i] = i;
		}

		public int findSet(int x) {
			return p[x] == x ? x : (p[x] = findSet(p[x]));
		}

		public boolean isunioned(int x, int y) {
			return findSet(x) == findSet(y);
		}

		public boolean union(int x, int y) {
			x = findSet(x);
			y = findSet(y);
			if (x == y) {
				return false;
			}
			if (rank[x] > rank[y])
				p[y] = x;
			else {
				p[x] = y;
				if (rank[x] == rank[y])
					++rank[y];
			}
			return true;
		}
	}

	static TreeSet<Integer>[] adjlist;
	static int[][] adjmatrix;
	static int[][] adjmatrix2;
	static boolean[] vis;
	static boolean[] intialvis;
	static boolean[] vis2;
	static Stack<Integer> st;
	static ArrayList<Integer> arrylist;
	static boolean flag;
	static int[] dx = new int[] { 1, -1, 0, 0 };
	static int[] dy = new int[] { 0, 0, 1, -1 };
	static boolean ans = true;;
	static int[] dist, parent;
	static boolean[] visited;
	static int src, dest;

	public static long gcd(long u, long v) {
		if (u == 0)
			return v;
		return gcd(v % u, u);
	}

	static long pow(long a, long n) {
		long res = 1;
		while (n != 0) {
			if ((n & 1) == 1) {
				res *= a;
				res %= 1e9 + 7;
			}
			a = (long) ((a * a) % (1e9 + 7));
			n >>= 1;
		}
		return res;
	}

	static ArrayList<Integer>[] adjList;
	static int V, E, counter[], c, SCC, dfs_num[], dfs_low[], Arr[];
	static int[] inSCC, cost;
	static Stack<Integer> stack;
	static PrintWriter pw;
	static long minn = 0, num = 1;

	public static double round(double d, int numbersAfterDecimalPoint) {
		long n = pow(10, numbersAfterDecimalPoint);
		double d2 = d * n;
		long l = (long) d2;
		return ((double) l) / n;
	}
	static int n;
	public static int brutee(int idx,int acc){
		if(idx>10)
			if(acc>=n)
			return 0;
			else
				return (int)(1e7);
				
		int take=Arr[idx]+brutee(idx+1,acc+Arr[idx]);
		int leave=brutee(idx+1,acc);
		return Math.min(take, leave);
	}
	public static void main(String[] args) throws IOException, InterruptedException {
		// FileWriter f = new FileWriter("C:\\Users\\Hp\\Desktop\\out.txt");
		// PrintWriter pw = new PrintWriter(f);
		pw = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
		Scanner sc = new Scanner(System.in);
			 n = sc.nextInt();
			int k=sc.nextInt();
			int min=(int) 1e6;
			int max=0;
			PriorityQueue<Pair>pq=new PriorityQueue<Pair>();
			for(int i=0;i<n;i++){
				int a=sc.nextInt();
				int b=sc.nextInt();
				min=Math.min(a,min);
				max=Math.max(max, b);
				pq.add(new Pair(a, b, i+1));
			}
			PriorityQueue<edge>pq2=new PriorityQueue<edge>();
			int[]Acc=new int[max+3];
//			for(Pair x:pq)System.out.print(x+" , ");
//			System.out.println();
			TreeSet<Integer>ans=new TreeSet<Integer>();
			for(int i=min;i<=max;i++){
				while(!pq.isEmpty()&&pq.peek().start<=i){
					Pair p=pq.poll();					
					Acc[p.end+1]++;
					pq2.add(new edge(p.start,p.end,p.idx));				
				}
				if(i!=0)
				Acc[i]+=Acc[i-1];
				int s=pq2.size();
//				System.out.println("***");
//				for(edge x:pq2)System.out.print(x+" , ");
//				System.out.println();
				for(int j=0;j<s-k-Acc[i];j++){
					edge e=pq2.poll();
					if(e.end<i)
						Acc[i]--;
					else{
						ans.add(e.idx);	
						Acc[e.end+1]--;
					}
				}
//				for(edge x:pq2)System.out.print(x+" , ");
//				System.out.println();
			}	
			pw.println(ans.size());
			for(int x:ans)pw.print(x+" ");
//			System.out.println(Arrays.toString(Acc));
		pw.close();
	}

	static class Scanner {
		StringTokenizer st;
		BufferedReader br;

		public Scanner(InputStream s) {
			br = new BufferedReader(new InputStreamReader(s));
		}

		public String next() throws IOException {
			while (st == null || !st.hasMoreTokens())
				st = new StringTokenizer(br.readLine());
			return st.nextToken();
		}

		public int nextInt() throws IOException {
			return Integer.parseInt(next());
		}

		public long nextLong() throws IOException {
			return Long.parseLong(next());
		}

		public String nextLine() throws IOException {
			return br.readLine();
		}

		public double nextDouble() throws IOException {
			String x = next();
			StringBuilder sb = new StringBuilder("0");
			double res = 0, f = 1;
			boolean dec = false, neg = false;
			int start = 0;
			if (x.charAt(0) == '-') {
				neg = true;
				start++;
			}
			for (int i = start; i < x.length(); i++)
				if (x.charAt(i) == '.') {
					res = Long.parseLong(sb.toString());
					sb = new StringBuilder("0");
					dec = true;
				} else {
					sb.append(x.charAt(i));
					if (dec)
						f *= 10;
				}
			res += Long.parseLong(sb.toString()) / f;
			return res * (neg ? -1 : 1);
		}

		public boolean ready() throws IOException {
			return br.ready();
		}

	}

}