#include <bits/stdc++.h>
using namespace std;
void solve() {
  long long n, m;
  scanf("%lld %lld", &n, &m);
  vector<long long> dp(m, -1);
  for (int i = 0; i < n; i++) {
    long long l, r;
    scanf("%lld %lld", &l, &r);
    for (int i = l - 1; i < r; i++) {
      dp[i] = 1;
    }
  }
  long long ans = 0;
  for (int i = 0; i < m; i++) {
    if (dp[i] == -1) ans += 1;
  }
  cout << ans << "\n";
  for (int i = 0; i < m; i++) {
    if (dp[i] == -1) cout << i + 1 << " ";
  }
  printf("\n");
  return;
}
int main() {
  long long t = 1;
  while (t--) {
    solve();
  }
  return 0;
}
