#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  cin >> n >> m;
  bool vis[m + 1];
  memset(vis, 0, sizeof(vis));
  for (int i = 0; i < n; i++) {
    int l, r;
    cin >> l >> r;
    for (int j = l; j <= r; j++) {
      vis[j] = 1;
    }
  }
  vector<int> ans;
  for (int i = 1; i <= m; i++) {
    if (!vis[i]) {
      ans.push_back(i);
      continue;
    }
  }
  cout << ans.size() << "\n";
  for (int i = 0; i < ans.size(); i++) {
    cout << ans[i] << " ";
  }
  return 0;
}
