#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  cin >> n >> m;
  int l[n], r[n], a[m];
  for (int i = 0; i < m; i++) a[i] = -1;
  for (int i = 0; i < n; i++) {
    cin >> l[i] >> r[i];
    for (int j = l[i] - 1; j <= r[i] - 1; j++) {
      a[j] = 0;
    }
  }
  int c = 0;
  for (int i = 0; i < m; i++) {
    if (a[i] == -1) {
      c++;
    }
  }
  cout << c << endl;
  for (int i = 0; i < m; i++) {
    if (a[i] == -1) {
      cout << i + 1 << " ";
    }
  }
  return 0;
}
