#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int n, k;
  cin >> n >> k;
  int hash[201] = {0};
  vector<pair<int, int>> v;
  for (int i = 0; i < n; i++) {
    int l, r;
    cin >> l >> r;
    v.push_back(make_pair(l, r));
    for (int j = l; j < r + 1; j++) hash[j]++;
  }
  vector<int> ans(n);
  for (int j = 0; j < 250; j++) {
    while (hash[j] > k) {
      int m = -1;
      for (int i = 0; i < n; i++) {
        if (!ans[i] && (j >= v[i].first && j <= v[i].second)) {
          if (m == -1 || v[i].second > v[m].second) m = i;
        }
      }
      if (m == -1) break;
      for (int i = v[m].first; i < v[m].second + 1; i++) hash[i]--;
      ans[m] = 1;
    }
  }
  cout << accumulate(ans.begin(), ans.end(), 0) << endl;
  for (int i = 0; i < n; i++)
    if (ans[i]) cout << i + 1 << " ";
}
