#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  cin >> n >> m;
  int a[n][2], b[m], g = 0;
  bool bo;
  for (int i = 0; i < n; i++)
    for (int j = 0; j < 2; j++) cin >> a[i][j];
  for (int k = 1; k <= m; k++) {
    for (int i = 0; i < n; i++)
      if (!(k >= a[i][0] && k <= a[i][1]))
        bo = true;
      else {
        bo = false;
        break;
      }
    if (bo == true) {
      b[g] = k;
      g++;
    }
  }
  cout << g << endl;
  for (int i = 0; i < g; i++) cout << b[i] << " ";
  return 0;
}
