#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  cin >> n >> m;
  map<int, int> x;
  for (int i = 0; i < n; i++) {
    int l, r;
    cin >> l >> r;
    if (x[l] != 1) {
      x[l]++;
    }
    if (x[r] != 1) {
      x[r]++;
    }
    for (int i = l + 1; i < r; i++) {
      if (x[i] != 1) {
        x[i]++;
      }
    }
  }
  int count = 0;
  vector<int> v;
  for (int i = 1; i <= m; i++) {
    if (x[i] != 1) {
      count++;
      v.push_back(i);
    }
  }
  cout << count << endl;
  for (int i = 0; i < v.size(); i++) {
    cout << v[i] << " ";
  }
  cout << endl;
}
