#include <bits/stdc++.h>
using namespace std;
int n, m, x, y, ary[300000 + 5];
int main(void) {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  cin >> n >> m;
  for (int i = 0; i < n; ++i) {
    cin >> x >> y;
    for (int j = x; j <= y; ++j) ary[j] = 1;
  }
  int ans = 0;
  for (int i = 1; i <= m; ++i)
    if (!ary[i]) {
      ans += 1;
    }
  cout << ans << "\n";
  for (int i = 1; i <= m; ++i)
    if (!ary[i]) {
      cout << i << " ";
    }
  return 0;
}
