#include <bits/stdc++.h>
using namespace std;
set<long long> section;
long long numerous, lenght, x, y, k;
int main() {
  cin >> numerous >> lenght;
  k = lenght;
  for (int i = 1; i <= lenght; i++) {
    section.insert(i);
  }
  for (int i = 0; i < numerous; i++) {
    cin >> x >> y;
    for (int j = x; j <= y; j++) {
      if (section.find(j) != section.end()) {
        section.erase(j);
        k--;
      }
    }
  }
  cout << k << endl;
  for (auto ost : section) {
    cout << ost << " ";
  }
  return 0;
}
