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