#include <bits/stdc++.h>
using namespace std;
unsigned long long n, k;
struct Node {
  int id, r;
  bool operator<(Node a) const { return r < a.r; }
};
Node a[500][500];
int cnt[500];
bool used[500];
int num[500];
int main() {
  cin >> n >> k;
  int x, y;
  for (int i = 1; i <= n; i++) {
    cin >> x >> y;
    for (int j = x; j <= y; j++) {
      cnt[j]++;
      a[j][cnt[j]].id = i;
      a[j][cnt[j]].r = y;
    }
  }
  for (int i = 1; i <= 200; i++) {
    sort(a[i] + 1, a[i] + 1 + cnt[i]);
    num[i] = cnt[i];
  }
  int ans = 0;
  for (int i = 1; i <= 200; i++) {
    if (num[i] > k) {
      while (num[i] > k) {
        if (used[a[i][cnt[i]].id]) {
          cnt[i]--;
          continue;
        }
        for (int j = i; j <= a[i][cnt[i]].r; j++) {
          num[j]--;
        }
        used[a[i][cnt[i]].id] = 1;
        cnt[i]--;
        ans++;
      }
    }
  }
  cout << ans << endl;
  for (int i = 1; i <= n; i++) {
    if (used[i]) {
      cout << i << " ";
    }
  }
}
