#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  cin >> n >> m;
  vector<bool> found(m, false);
  int count = 0;
  int a, b;
  while (n--) {
    cin >> a >> b;
    for (; a <= b; a++) {
      if (not found[a - 1]) {
        found[a - 1] = true;
        count++;
      }
    }
  }
  cout << m - count << endl;
  for (int i = 0; i < m; i++) {
    if (not found[i]) cout << i + 1 << ' ';
  }
  cout << endl;
}
