#include <bits/stdc++.h>
using namespace std;
int main() {
  int n = 0, m = 0;
  cin >> n >> m;
  vector<int> vec(n * 2, 0);
  for (int i = 0; i < n * 2; i++) cin >> vec[i];
  vector<bool> fr(m + 1, 0);
  for (auto i : vec) fr[i] = 1;
  int counter = 0;
  for (int i = 0; i < vec.size() - 1; i += 2) {
    for (int j = vec[i]; j <= vec[i + 1]; j++) {
      fr[j] = 1;
    }
  }
  for (int i = 1; i < fr.size(); i++)
    if (fr[i] == 0) counter++;
  cout << counter << endl;
  for (int i = 1; i < fr.size(); i++)
    if (fr[i] == 0) cout << i << " ";
  cout << endl;
  return 0;
}
