#include <bits/stdc++.h>
using namespace std;
void solve() {
  long long int n, m, flag = 0;
  cin >> n >> m;
  pair<long long int, long long int> a[n];
  vector<long long int> ans;
  for (int i = 0; i < n; i++) cin >> a[i].first >> a[i].second;
  for (int i = 1; i <= m; i++) {
    flag = 0;
    for (int j = 0; j < n; j++) {
      if (i >= a[j].first && i <= a[j].second) {
        flag = 1;
        break;
      }
    }
    if (flag == 0) ans.push_back(i);
  }
  cout << ans.size() << endl;
  for (auto x : ans) cout << x << " ";
  return;
}
int main() {
  long long int t = 1;
  while (t--) solve();
  return 0;
}
