#include <bits/stdc++.h>
using namespace std;
int main() {
  int i, n, m, a, b, vetor[1000] = {0}, j, cont = 0;
  cin >> n >> m;
  for (i = 0; i < n; i++) {
    cin >> a >> b;
    for (j = a; j <= b; j++) vetor[j] = 1;
  }
  for (i = 1; i <= m; i++)
    if (vetor[i] == 0) cont++;
  if (cont > 0) {
    cout << cont << endl;
    for (i = 1; i <= m; i++)
      if (vetor[i] == 0) cout << i << " ";
  } else {
    cout << cont << endl;
  }
}
