#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 5, mod = 1e9 + 7;
int n, k;
int l[250], r[250];
int cnt[250], CntRange[250];
vector<bool> vis;
int GetOptimal(int p) {
  pair<int, int> cur = make_pair(-1, -1);
  int pos = -1;
  for (int i = 1; i <= n; i++) {
    if (vis[i]) continue;
    if (p >= l[i] and p <= r[i] and (pos == -1 or cur.second < r[i]))
      cur = make_pair(l[i], r[i]), pos = i;
  }
  return pos;
}
int solve() {
  scanf("%d%d", &n, &k);
  vis.resize(n + 5, 0);
  int minleft = 1000, maxright = 0;
  for (int i = 1; i <= n; i++) {
    scanf("%d%d", &l[i], &r[i]);
    minleft = min(minleft, l[i]);
    maxright = max(maxright, r[i]);
  }
  for (int i = minleft; i <= maxright; i++)
    for (int j = 1; j <= n; j++) cnt[i] += (i >= l[j] and i <= r[j]);
  vector<int> Ans;
  for (int i = minleft; i <= maxright; i++) {
    while (cnt[i] > k) {
      int ret = GetOptimal(i);
      if (ret == -1) break;
      for (int j = l[ret]; j <= r[ret]; j++) cnt[j]--;
      vis[ret] = 1;
      Ans.push_back(ret);
    }
  }
  printf("%d\n", (int)Ans.size());
  for (int x : Ans) printf("%d ", x);
  return 0;
}
int main() { solve(); }
