#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n, k;
  cin >> n >> k;
  vector<set<int> > ss(201);
  for (int i = 0; i < n; i++) {
    int l, r;
    cin >> l >> r;
    for (int j = l; j <= r; j++) {
      ss[j].insert(i);
    }
  }
  vector<int> ans;
  for (int i = 1; i <= 200; i++) {
    while ((int)ss[i].size() > k) {
      int right = -1, seg = -1;
      for (int x : ss[i]) {
        for (int j = 200; j >= 1; j--) {
          if (ss[j].find(x) == ss[j].end()) continue;
          if (j > right) {
            right = j;
            seg = x;
          }
          break;
        }
      }
      ans.push_back(seg);
      for (int j = i; j <= 200; j++) {
        ss[j].erase(seg);
      }
    }
  }
  cout << ans.size() << '\n';
  for (int i = 0; i < (int)ans.size(); i++) {
    if (i > 0) cout << ' ';
    cout << ans[i] + 1;
  }
  cout << '\n';
  return 0;
}
