#include <bits/stdc++.h>
using namespace std;
const int N = 1e3 + 5;
int main() {
  int num, r;
  cin >> num >> r;
  vector<pair<int, int>> arr(num + 1);
  vector<bool> visited(r + 2, 0);
  for (int i = 1; i <= num; ++i) {
    cin >> arr[i].first >> arr[i].second;
    for (int j = arr[i].first; j <= arr[i].second; ++j) {
      visited[j] = 1;
    }
  }
  long long ans = 0;
  for (int k = 1; k <= r; ++k) {
    if (visited[k] == 0) ans++;
  }
  cout << ans << "\n";
  for (int k = 1; k <= r; ++k) {
    if (visited[k] == 0) cout << k << " ";
  }
}
