#include <bits/stdc++.h>
const int maxn = 100000;
using namespace std;
vector<int> ans;
int n, k, mi, ma, ma1, p;
int l[maxn], r[maxn], a[maxn];
bool c[maxn];
int main() {
  cin >> n >> k;
  mi = l[0];
  ma = r[0];
  for (int i = 0; i < n; i++) {
    cin >> l[i] >> r[i];
    mi = min(mi, l[i]);
    ma = max(ma, r[i]);
  }
  for (int i = 0; i < n; i++)
    for (int j = l[i]; j <= r[i]; j++) {
      a[j]++;
    }
  for (int i = mi; i <= ma; i++)
    while (a[i] > k) {
      ma1 = 0;
      for (int j = 0; j < n; j++)
        if (c[j] == 0) {
          if (l[j] <= i && r[j] >= i) {
            if (r[j] > ma1) {
              ma1 = r[j];
              p = j;
            }
          }
        }
      c[p] = 1;
      for (int j = i; j <= ma1; j++) a[j]--;
      ans.push_back(p + 1);
    }
  cout << ans.size() << endl;
  sort(ans.begin(), ans.end());
  for (int i : ans) cout << i << " ";
}
