#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  int m;
  cin >> n >> m;
  bool ans[m + 1];
  for (int i = 0; i <= m; i++) {
    ans[i] = false;
  }
  int a[n];
  vector<pair<int, int> > v;
  for (int i = 0; i < n; i++) {
    int a;
    int b;
    cin >> a;
    cin >> b;
    v.push_back(make_pair(a, b));
  }
  for (int i = 0; i < n; i++) {
    int start = v[i].first;
    int end = v[i].second;
    for (int j = start; j <= end; j++) {
      if (ans[j] == false) ans[j] = true;
    }
  }
  vector<int> final;
  int result = 0;
  for (int i = 1; i <= m; i++) {
    if (ans[i] == false) {
      final.push_back(i);
      result++;
    }
  }
  cout << result << endl;
  for (int i = 0; i < final.size(); i++) {
    cout << final[i] << " ";
  }
}
