#include <bits/stdc++.h>
using namespace std;
struct cor {
  int l, r, num;
};
cor a[300];
int m[300], maxx = -1e4, minn = 1e4, AnsNum[300], ans;
bool cmp(cor x, cor y) {
  if (x.r > y.r || (x.r == y.r && x.l > y.l))
    return true;
  else
    return false;
}
int PosM(int ll, int rr) {
  int temp = rr;
  for (int jj = rr; jj >= ll; jj--)
    if (m[jj] >= m[temp]) temp = jj;
  return temp;
}
int main() {
  int n, k;
  cin >> n >> k;
  for (int i = 0; i < n; i++) {
    cin >> a[i].l >> a[i].r;
    a[i].num = i;
    if (a[i].r > maxx) maxx = a[i].r;
    if (a[i].l < minn) minn = a[i].l;
    for (int j = a[i].l; j <= a[i].r; j++) m[j]++;
  }
  sort(a, a + n, cmp);
  while (true) {
    int it = PosM(minn, maxx);
    if (m[it] <= k) break;
    for (int i = 0; i < n; i++)
      if (a[i].l <= it) {
        ans++;
        for (int j = a[i].l; j <= a[i].r; j++) m[j]--;
        AnsNum[ans] = a[i].num;
        a[i].l = 100000;
        a[i].r = 100000;
        break;
      }
  }
  cout << ans << "\n";
  for (int i = 1; i <= ans; i++) cout << AnsNum[i] + 1 << " ";
}
