#include <bits/stdc++.h>
using namespace std;
const double eps = 1e-9;
const int inf = 2000000000;
const long long int infLL = 9000000000000000000;
const int Mx = 1e3 + 123;
long long int n, m, l, r, c = 0;
bool a[Mx] = {true};
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  cin >> n >> m;
  for (long long int i = 1; i <= m; i++) a[i] = true;
  for (long long int i = 0; i < n; i++) {
    cin >> l >> r;
    for (long long int j = l; j <= r; j++) {
      if (a[j]) {
        a[j] = false;
        c++;
      }
    }
  }
  cout << m - c << endl;
  for (long long int i = 1; i <= m; i++) {
    if (a[i] == true) cout << i << " ";
  }
  cout << endl;
  return 0;
}
