#include <bits/stdc++.h>
using namespace std;
int n, m, c, f;
int l[105];
int r[105];
int z[105];
int a[105];
bool t;
int main() {
  cin >> n >> m;
  n--;
  for (int x = 0; x <= n; x++) {
    cin >> l[x] >> r[x];
    while (l[x] <= r[x]) {
      for (int e = 0; e <= c; e++) {
        if (l[x] == z[e]) {
          t = 1;
          break;
        }
      }
      if (t == 0) {
        z[c] = l[x];
        c++;
      }
      l[x]++;
      t = 0;
    }
  }
  for (int x = 1; x <= m; x++) {
    for (int e = 0; e <= c; e++) {
      if (z[e] == x) {
        t = 1;
        break;
      }
    }
    if (t == 0) {
      a[f] = x;
      f++;
    }
    t = 0;
  }
  cout << f << endl;
  for (int x = 0; x < f; x++) cout << a[x] << " ";
  cout << endl;
  return 0;
}
