#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int t, n, m, a, b;
  cin >> n >> m;
  vector<int> data(m + 2, 0);
  while (n--) {
    cin >> a >> b;
    ++data[a];
    data[b + 1]--;
  }
  vector<int> ans;
  for (int i = 1; i <= m; ++i) {
    data[i] += data[i - 1];
    if (data[i] == 0) ans.push_back(i);
  }
  n = (int)ans.size();
  cout << n << "\n";
  for (int i = 0; i < n; ++i) cout << ans[i] << " \n"[i == n - 1];
  return 0;
}
