#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, x[10000] = {0}, dem = 0;
  cin >> n >> m;
  pair<int, int> a[10000];
  for (int i = 0; i < n; i++) {
    cin >> a[i].first >> a[i].second;
    for (int k = a[i].first; k <= a[i].second; k++) x[k] = 1;
  }
  for (int i = 1; i <= m; i++) {
    if (x[i] == 0) dem++;
  }
  cout << dem << endl;
  for (int i = 1; i <= m; i++) {
    if (x[i] == 0) cout << i << " ";
  }
}
