#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  cin >> n >> m;
  vector<bool> arr(m, false);
  int x, y;
  while (n--) {
    cin >> x >> y;
    for (int i = x - 1; i <= y - 1; i++) arr[i] = true;
  }
  int cnt = 0;
  for (int i = 0; i < m; i++) {
    if (arr[i] == false) cnt++;
  }
  cout << cnt << endl;
  if (cnt > 0) {
    for (int i = 0; i < m; i++) {
      if (arr[i] == false) cout << i + 1 << " ";
    }
    cout << endl;
  }
}
