#include <bits/stdc++.h>
using namespace std;
vector<int> cover[201];
vector<int> ans;
int main() {
  int N, K;
  cin >> N >> K;
  for (int seg = 1; N; --N, ++seg) {
    int l, r;
    cin >> l >> r;
    for (int idx = l; idx <= r; ++idx) cover[idx].push_back(seg);
  }
  for (int point = 1; point <= 200; ++point)
    if (cover[point].size() > K) {
      vector<int> freq(201);
      for (const int &itm : cover[point]) ++freq[itm];
      for (int idx = 1; idx <= 200; ++idx)
        if (idx != point && cover[idx].size() > K)
          for (const int &itm : cover[idx])
            if (freq[itm]) ++freq[itm];
      int seg = 0;
      for (int idx = 1; idx <= 200; ++idx)
        if (freq[idx] > freq[seg]) seg = idx;
      for (int idx = 1; idx <= 200; ++idx) {
        bool found = false;
        vector<int>::iterator itFound;
        for (auto it = cover[idx].begin(); it != cover[idx].end(); ++it)
          if (seg == *it) {
            found = true;
            itFound = it;
            break;
          }
        if (found) cover[idx].erase(itFound);
      }
      ans.push_back(seg);
      if (cover[point].size() > K) --point;
    }
  cout << ans.size() << '\n';
  for (const int &itm : ans) cout << itm << ' ';
}
