#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5;
void solve() {
  int n, m;
  cin >> n >> m;
  int A[m + 5];
  memset(A, 0, sizeof(A));
  int a, b;
  for (int i = (int)1; i <= (int)n; i++) {
    cin >> a >> b;
    A[a] += 1;
    A[b + 1] -= 1;
  }
  for (int i = 1; i <= m; i++) A[i] = A[i - 1] + A[i];
  vector<int> ans;
  int cnt = 0;
  for (int i = (int)1; i <= (int)m; i++)
    if (A[i] == 0) ans.push_back(i);
  cout << ans.size() << '\n';
  for (auto i : ans) cout << i << ' ';
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  solve();
  return 0;
}
