#include <bits/stdc++.h>
using namespace std;
inline int read() {
  int ret = 0, f = 0;
  char c = getchar();
  while (!isdigit(c)) {
    if (c == '-') f = 1;
    c = getchar();
  }
  while (isdigit(c)) {
    ret = ret * 10 + c - 48;
    c = getchar();
  }
  if (f) return -ret;
  return ret;
}
const int N = 205;
int n, k;
int l[N], r[N], sum[N], ans[N];
bool vis[N];
struct number {
  int l, r, w, id;
} num[N];
inline bool cmp(number a, number b) { return a.r > b.r; }
int main() {
  n = read();
  k = read();
  for (register int i = 1; i <= n; ++i) {
    l[i] = read(), r[i] = read();
    for (register int j = l[i]; j <= r[i]; ++j) sum[j]++;
    num[i].l = l[i];
    num[i].r = r[i];
    num[i].id = i;
  }
  sort(num + 1, num + n + 1, cmp);
  for (register int i = 1; i <= 200; ++i)
    if (sum[i] > k) {
      int tim = sum[i] - k;
      for (register int add = 1; add <= tim; ++add) {
        for (register int j = 1; j <= n; ++j)
          if (num[j].l <= i && i <= num[j].r && !vis[j]) {
            for (register int kk = num[j].l; kk <= num[j].r; ++kk) sum[kk]--;
            vis[j] = true;
            ans[num[j].id] = 1;
            break;
          }
      }
    }
  int sum = 0;
  for (register int i = 1; i <= n; ++i)
    if (ans[i]) sum++;
  printf("%d\n", sum);
  for (register int i = 1; i <= n; ++i)
    if (ans[i]) printf("%d ", i);
  return 0;
}
