#include <bits/stdc++.h>
using namespace std;
const long long MAX = 201 + 10;
const long long inf = 1e9;
long long t[MAX];
set<pair<long long, long long> > q[MAX];
pair<long long, long long> a[MAX];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long n, k, l, r;
  cin >> n >> k;
  for (long long i = 1; i < (long long)n + 1; i++) {
    cin >> a[i].first >> a[i].second;
    for (long long j = a[i].first; j < (long long)a[i].second + 1; j++) {
      t[j]++;
      q[j].insert({a[i].second, i});
    }
  }
  vector<long long> ans;
  long long ind = 1;
  while (ind <= 200) {
    if (t[ind] > k) {
      pair<long long, long long> x = *(--q[ind].end());
      for (long long i = ind; i < (long long)x.first + 1; i++) {
        q[i].erase(x);
        t[i]--;
      }
      ans.push_back(x.second);
    } else
      ind++;
  }
  cout << ans.size() << endl;
  for (long long i = 0; i < (long long)ans.size(); i++) cout << ans[i] << " ";
  cout << endl;
}
