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