#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  long long int c = 0, l, r, i, j, k, t, n, s;
  cin >> s >> n;
  long long int a[n];
  for (i = 0; i < s; i++) {
    cin >> l >> r;
    for (j = l - 1; j < r; j++) {
      if (a[j] != 1) {
        a[j] = 1;
        c++;
      }
    }
  }
  cout << n - c << "\n";
  for (i = 0; i < n; i++) {
    if (a[i] != 1) cout << i + 1 << " ";
  }
}
