#include <bits/stdc++.h>
using namespace std;
long long mod = 1e9 + 7;
long long inf = 1e17;
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long n, m;
  cin >> n >> m;
  long long l[n], r[n];
  for (long long i = 0; i < n; i++) {
    cin >> l[i] >> r[i];
  }
  long long d[m + 1];
  memset(d, 0, sizeof(d));
  long long ans = 0;
  for (long long i = 0; i < n; i++) {
    for (long long j = l[i]; j <= r[i]; j++) {
      if (d[j] == 0) ans++;
      d[j] = 1;
    }
  }
  ans = m - ans;
  cout << ans << "\n";
  for (long long i = 1; i <= m; i++) {
    if (d[i] == 0) cout << i << " ";
  }
  cout << "\n";
}
