#include <bits/stdc++.h>
using namespace std;
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long n, k;
  cin >> n >> k;
  vector<long long> a(k + 5, 0);
  for (long long i = 0; i < n; ++i) {
    long long u, v;
    cin >> u >> v;
    a[u]++;
    a[v + 1]--;
  }
  vector<long long> ans;
  long long cur = 0;
  for (long long i = 1; i <= k; ++i) {
    cur += a[i];
    if (cur == 0) {
      ans.push_back(i);
    }
  }
  cout << ans.size() << '\n';
  for (auto i : ans) {
    cout << i << " ";
  }
}
