#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 5, MOD = 1e9 + 7;
long long int n, m, a[N], b[N], x, y, ans, c, p, q, t, k, w, h, sum, mx;
string s, s1;
char ch;
vector<char> v;
set<long long int> st;
map<char, long long int> mp;
map<long long int, long long int>::iterator itr;
int main() {
  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  ;
  cin >> n >> m;
  while (n--) {
    cin >> x >> y;
    for (int i = x; i <= y; i++) a[i] = 1;
  }
  for (int i = 1; i <= m; i++)
    if (!a[i]) ans++, b[p] = i, p++;
  cout << ans << endl;
  for (int i = 0; i < p; i++) cout << b[i] << " ";
  return 0;
}
