#include <bits/stdc++.h>
using namespace std;
void openFiles() {
  freopen("input.txt", "r", stdin);
  freopen("output.txt", "w", stdout);
}
bool cmp(pair<long long int, long long int> a,
         pair<long long int, long long int> b) {
  return a.second < b.second;
}
int main() {
  ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  long long int n, k;
  cin >> n >> k;
  vector<pair<long long int, long long int> > v;
  long long int pre[300] = {0};
  for (long long int i = 0; i < n; i++) {
    long long int x, y;
    cin >> x >> y;
    v.push_back({x, y});
    pre[x]++;
    pre[y + 1]--;
  }
  for (long long int i = 2; i <= 250; i++) {
    pre[i] += pre[i - 1];
  }
  bool done[n];
  memset(done, false, sizeof(done));
  for (long long int i = 1; i <= 250; i++) {
    while (pre[i] > k) {
      long long int pos = -1;
      for (long long int p = 0; p < n; p++) {
        if (done[p] == false && v[p].first <= i && v[p].second >= i &&
            (pos == -1 || v[p].second > v[pos].second)) {
          pos = p;
        }
      }
      if (pos != -1) {
        for (long long int j = v[pos].first; j <= v[pos].second; j++) {
          pre[j]--;
        }
      }
      done[pos] = true;
    }
  }
  long long int c = 0;
  vector<long long int> ans;
  for (long long int i = 0; i < n; i++) {
    if (done[i]) c++, ans.push_back(i);
  }
  cout << c << endl;
  for (auto x : ans) {
    cout << x + 1 << " ";
  }
  return 0;
}
