#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int n, m;
  cin >> n >> m;
  int x, y;
  vector<pair<int, int> > A(n);
  vector<int> B;
  for (int i = 0; i < n; i++) {
    cin >> x >> y;
    A[i].first = x;
    A[i].second = y;
  }
  sort(A.begin(), A.end());
  int last = 0, next;
  for (int i = 0; i < A.size(); i++) {
    next = A[i].first;
    if (next < last) {
      if (A[i].second > last) last = A[i].second;
      continue;
    }
    last++;
    while (last < next) {
      B.push_back(last);
      last++;
    }
    last = A[i].second;
  }
  last++;
  while (last < m + 1) {
    B.push_back(last);
    last++;
  }
  int size = B.size();
  cout << size << endl;
  for (int i = 0; i < size; i++) {
    cout << B[i] << " ";
  }
  return 0;
}
