#include <bits/stdc++.h>
using namespace std;
int n, k;
vector<int> bad;
set<pair<int, pair<int, int> > > segm;
int points[256];
vector<int> ans;
int main() {
  cin >> n >> k;
  for (int i = 1; i <= n; i++) {
    int l, r;
    cin >> l >> r;
    segm.insert({i, {l, r}});
    for (int j = l; j <= r; j++) points[j]++;
  }
  for (int i = 1; i <= 200; i++) {
    if (points[i] > k) bad.push_back(i);
  }
  for (auto p : bad) {
    while (points[p] > k) {
      pair<int, pair<int, int> > best = {-1, {-1, -1}};
      for (auto x : segm)
        if (x.second.first <= p && x.second.second >= p &&
            x.second.second >= best.second.second)
          best = x;
      segm.erase(best);
      for (int i = best.second.first; i <= best.second.second; i++) points[i]--;
      ans.push_back(best.first);
    }
  }
  cout << ans.size() << '\n';
  for (auto x : ans) cout << x << ' ';
}
