#include <bits/stdc++.h>
using namespace std;
vector<pair<pair<int, int>, int> > v;
bool cmp(pair<pair<int, int>, int> x, pair<pair<int, int>, int> y) {
  return x.first.second > y.first.second;
}
vector<int> a[201];
vector<int> ele;
int flag[201];
int main() {
  int n, k;
  cin >> n >> k;
  int l = 200, r = 0;
  for (int i = 1; i <= n; i++) {
    int x, y;
    cin >> x >> y;
    v.push_back(make_pair(make_pair(x, y), i));
    l = min(l, x);
    r = max(r, y);
  }
  sort(v.begin(), v.end(), cmp);
  for (int i = l; i <= r; i++) {
    for (int j = 0; j < v.size(); j++) {
      if (v[j].first.first <= i && v[j].first.second >= i) {
        a[i].push_back(v[j].second);
      }
    }
    if (a[i].size() > k) {
      ele.push_back(i);
    }
  }
  vector<int> ans;
  for (auto i : ele) {
    int cnt = a[i].size() - k;
    for (int j = 0; j < a[i].size(); j++) {
      if (flag[a[i][j]] == 1) {
        cnt--;
      }
    }
    if (cnt > 0) {
      for (int j = 0; j < a[i].size(); j++) {
        int temp = a[i][j];
        if (flag[temp] == 0 && cnt > 0) {
          flag[temp] = 1;
          ans.push_back(temp);
          cnt--;
        }
      }
    }
  }
  cout << ans.size() << endl;
  for (int i = 0; i < ans.size(); i++) {
    cout << ans[i] << " ";
  }
}
