#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, i, j, k, x, cnt = 0;
  cin >> n >> m;
  int li[n], ri[n], ara[m];
  for (i = 0; i < n; i++) {
    cin >> li[i] >> ri[i];
  }
  for (i = 1, k = 0; i <= m; i++) {
    x = 0;
    for (j = 0; j < n; j++) {
      if (i >= li[j] && i <= ri[j]) {
        x = 1;
        break;
      }
    }
    if (x != 1) {
      ara[k++] = i;
      cnt++;
    }
  }
  if (cnt == 0)
    cout << "0" << endl;
  else {
    cout << cnt << endl;
    for (i = 0; i < k; i++) {
      if (i > 0) cout << " ";
      cout << ara[i];
    }
  }
  cout << endl;
  return 0;
}
