#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  cin >> n >> m;
  unordered_set<int> s;
  for (int i = 1; i <= m; ++i) {
    s.insert(i);
  }
  for (int i = 0; i < n; ++i) {
    int l, r;
    cin >> l >> r;
    for (int j = l; j <= r; ++j) {
      s.erase(j);
    }
  }
  cout << s.size() << endl;
  for (auto el : s) {
    cout << el << ' ';
  }
  cout << endl;
  return 0;
}
