#include <bits/stdc++.h>
using namespace std;
const int N = 205;
inline int read() {
  int f = 1, x = 0;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = x * 10 + ch - 48;
    ch = getchar();
  }
  return f * x;
}
int n, k;
int cnt[N];
int main() {
  cin >> n >> k;
  vector<pair<int, int> > segs(n);
  vector<int> ans(n);
  for (int i = 0; i < n; i++) {
    cin >> segs[i].first >> segs[i].second;
    cnt[segs[i].first]++, cnt[segs[i].second + 1]--;
  }
  for (int i = 1; i < N; i++) cnt[i] += cnt[i - 1];
  for (int i = 1; i < N; i++) {
    while (cnt[i] > k) {
      int pos = -1;
      for (int p = 0; p < n; p++) {
        if (!ans[p] && (segs[p].first <= i && segs[p].second >= i) &&
            (pos == -1 || segs[p].second > segs[pos].second)) {
          pos = p;
        }
      }
      for (int j = segs[pos].first; j <= segs[pos].second; j++) cnt[j]--;
      ans[pos] = 1;
    }
  }
  cout << accumulate(ans.begin(), ans.end(), 0) << endl;
  for (int i = 0; i < n; i++) {
    if (ans[i]) cout << i + 1 << " ";
  }
  cout << endl;
  return 0;
}
