#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  cin >> n >> m;
  int t[1005] = {false};
  int l, r;
  for (int i = 0; i < n; i++) {
    cin >> l >> r;
    for (int j = l; j <= r; j++) {
      t[j] = true;
    }
  }
  int count = 0;
  for (int i = 1; i <= m; i++) {
    if (!t[i]) count++;
  }
  cout << count << endl;
  for (int i = 1; i <= m; i++)
    if (!t[i]) cout << i << " ";
  cout << endl;
}
