#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, x = 0;
  cin >> n >> m;
  int arr[m + 1];
  for (int i = 0; i <= m; i++) arr[i] = 0;
  for (int i = 0; i < n; i++) {
    int l, r;
    cin >> l >> r;
    for (int j = l; j <= r; j++) arr[j] = 1;
  }
  for (int i = 1; i <= m; i++) {
    if (arr[i] == 0) x++;
  }
  cout << x << endl;
  if (x != 0) {
    for (int i = 1; i <= m; i++) {
      if (arr[i] == 0) cout << i << " ";
    }
  }
  return 0;
}
