#include <bits/stdc++.h>
using namespace std;
vector<pair<int, int>> v;
int n, m;
vector<int> ans;
bool solve(int i) {
  for (pair<int, int> p : v) {
    if (i >= p.first && i <= p.second) {
      return true;
    }
  }
  return false;
}
int main() {
  cin >> n >> m;
  for (int i = 0; i < n; i++) {
    int a, b;
    cin >> a >> b;
    v.push_back(make_pair(a, b));
  }
  for (int i = 1; i <= m; i++) {
    if (!solve(i)) {
      ans.push_back(i);
    }
  }
  cout << ans.size() << "\n";
  for (int i : ans) {
    cout << i << " ";
  }
}
