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 CPP):

Solution:
#include <bits/stdc++.h>
using namespace std;
int a[400005] = {0};
int tree[4 * 400005] = {0};
int lazy[4 * 400005] = {0};
vector<pair<int, int> > v[100005];
vector<int> g[100005];
int ans[100005] = {0};
void build(int node, int l, int r) {
  if (l == r) {
    tree[node] = 0;
    lazy[node] = 0;
    return;
  }
  int mid = (l + r) / 2;
  build(2 * node, l, mid);
  build(2 * node + 1, mid + 1, r);
  tree[node] = min(tree[2 * node], tree[2 * node + 1]);
}
void add(int node, int start, int end) {
  tree[node] += lazy[node];
  if (start != end) {
    lazy[2 * node] += lazy[node];
    lazy[2 * node + 1] += lazy[node];
  }
  lazy[node] = 0;
}
int n;
void update(int node, int start, int end, int l, int r, int x) {
  if (lazy[node] != 0) {
    add(node, start, end);
  }
  if (l > end || r < start) return;
  if (start >= l && end <= r) {
    lazy[node] += x;
    if (lazy[node] != 0) {
      add(node, start, end);
    }
  } else {
    int mid = (start + end) / 2;
    update(2 * node, start, mid, l, r, x);
    update(2 * node + 1, mid + 1, end, l, r, x);
    tree[node] = min(tree[2 * node], tree[2 * node + 1]);
  }
}
int query(int node, int start, int end, int l, int r) {
  if (lazy[node] != 0) {
    add(node, start, end);
  }
  if (l > end || r < start) return 1e9;
  if (start >= l && end <= r) {
    return tree[node];
  } else {
    int mid = (start + end) / 2;
    int p1 = query(2 * node, start, mid, l, r);
    int p2 = query(2 * node + 1, mid + 1, end, l, r);
    return min(p1, p2);
  }
}
int main() {
  int q, k;
  int l[200005], r[200005];
  cin >> q >> k;
  vector<pair<int, int> > s[200005];
  for (int i = 1; i <= q; i++) {
    cin >> l[i] >> r[i];
    update(1, 1, 200000, l[i], r[i], 1);
    s[l[i]].push_back(make_pair(r[i], i));
  }
  for (int i = 1; i <= 200000; i++) {
    sort(s[i].begin(), s[i].end());
  }
  set<pair<int, int> > ss;
  vector<int> v;
  for (int i = 1; i <= 200000; i++) {
    int x = query(1, 1, 200000, i, i);
    if (x > k) {
      int p = x - k;
      if (ss.size() == 0) {
        int y = s[i].size() - 1;
        for (int j = 1; j <= x - k; j++) {
          update(1, 1, 200000, i, s[i][y].first, -1);
          v.push_back(s[i][y].second);
          y--;
        }
        for (int j = y; j >= 0; j--) {
          ss.insert(make_pair(-1 * s[i][j].first, s[i][j].second));
        }
      } else {
        int y = s[i].size() - 1;
        while (p > 0) {
          p--;
          auto it = ss.begin();
          if (y >= 0 && it != ss.end() && s[i][y].first >= (-1 * it->first)) {
            update(1, 1, 200000, i, s[i][y].first, -1);
            v.push_back(s[i][y].second);
            y--;
          } else if (y >= 0 && it != ss.end() &&
                     s[i][y].first < (-1 * it->first)) {
            update(1, 1, 200000, i, -1 * it->first, -1);
            v.push_back(it->second);
            ss.erase(it);
          } else if (y >= 0) {
            update(1, 1, 200000, i, s[i][y].first, -1);
            v.push_back(s[i][y].second);
            y--;
          } else {
            update(1, 1, 200000, i, -1 * it->first, -1);
            v.push_back(it->second);
            ss.erase(it);
          }
        }
        for (int j = y; j >= 0; j--) {
          ss.insert(make_pair(-1 * s[i][j].first, s[i][j].second));
        }
      }
    } else {
      int y = s[i].size() - 1;
      for (int j = y; j >= 0; j--) {
        ss.insert(make_pair(-1 * s[i][j].first, s[i][j].second));
      }
    }
  }
  cout << v.size() << endl;
  for (int i = 0; i < v.size(); i++) cout << v[i] << " ";
  cout << endl;
}