#include <bits/stdc++.h>
using namespace std;
using ll = long long int;
using P = pair<int, int>;
using T = tuple<int, int, int>;
using edge = struct { int to, cost; };
const int MOD = 1e9 + 7;
const int iINF = 1e9;
const long long int llINF = 1e18;
const double PI = acos(-1.0);
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int N, M;
  cin >> N >> M;
  vector<bool> vec(M, false);
  for (int i = 0; i < (N); i++) {
    int l, r;
    cin >> l >> r;
    l--;
    for (int j = l; j < (r); j++) {
      vec[j] = true;
    }
  }
  vector<int> ans;
  for (int i = 0; i < (M); i++) {
    if (vec[i]) continue;
    ans.push_back(i + 1);
  }
  cout << (int)(ans).size() << endl;
  for (auto x : ans) {
    cout << x << " ";
  }
  cout << endl;
  return 0;
}
