#include <bits/stdc++.h>
using namespace std;
int n, k;
int l[2009], r[2009], a[2009], b[2009], c[2009];
int main() {
  int ans = 0;
  scanf("%d%d", &n, &k);
  for (int i = 1; i <= n; i++) {
    scanf("%d%d", &l[i], &r[i]);
    for (int j = l[i]; j <= r[i]; j++) a[j]++;
  }
  for (int i = 1; i <= 200; i++) {
    if (a[i] > k) {
      ans++;
      b[ans] = i;
    }
  }
  int anss = 0;
  for (int i = 1; i <= ans; i++) {
    if (a[b[i]] <= k)
      continue;
    else
      while (a[b[i]] > k) {
        int maxx = 0, bj = 0;
        for (int j = 1; j <= n; j++)
          if (l[j] <= b[i] && r[j] > maxx) {
            maxx = r[j];
            bj = j;
          }
        l[bj] = 2000;
        r[bj] = 0;
        anss++;
        c[anss] = bj;
        for (int j = i; j <= ans; j++)
          if (b[j] <= maxx) a[b[j]]--;
      }
  }
  printf("%d\n", anss);
  for (int i = 1; i <= anss; i++) printf("%d ", c[i]);
  return 0;
}
