#include <bits/stdc++.h>
using namespace std;
long long int isprime(long long int n) {
  for (long long int i = 2; i * i <= n; i++) {
    if (n % i == 0) return 0;
  }
  return 1;
}
void solve() {
  long long int n, m;
  cin >> n >> m;
  long long int a[m + 1];
  memset(a, 0, sizeof(a));
  for (long long int i = 0; i < n; i++) {
    long long int x, z;
    ;
    cin >> x >> z;
    for (long long int j = x; j <= z; j++) {
      a[j] = 1;
    }
  }
  vector<long long int> v;
  for (long long int i = 1; i <= m + 1; i++) {
    if (a[i] == 0) v.push_back(i);
  }
  if (v.size() > 0) {
    cout << v.size() << endl;
    for (long long int i = 0; i < v.size(); i++) {
      cout << v[i] << " ";
    }
    cout << endl;
  } else
    cout << 0 << endl;
}
signed main() { solve(); }
