#include <bits/stdc++.h>
using namespace std;
int arr[1005], arr2[1005];
int n, m;
int main() {
  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0), cout.precision(15);
  while (cin >> n >> m) {
    vector<int> v;
    for (int i = int(0); i < int(n); i++) cin >> arr[i] >> arr2[i];
    for (int i = int(1); i < int(m + 1); i++) {
      bool b = 1;
      for (int j = int(0); j < int(n); j++) {
        if (arr[j] <= i && i <= arr2[j]) {
          b = 0;
        }
      }
      if (b) v.push_back(i);
    }
    cout << v.size() << endl;
    if (v.size()) cout << v[0];
    for (int i = int(1); i < int(v.size()); i++) {
      cout << " " << v[i];
    }
    if (v.size()) {
      cout << endl;
    }
  }
  return 0;
}
