#include <bits/stdc++.h>
using namespace std;
int arr[1000005];
int main() {
  int n, i, m, j, l, r;
  cin >> n >> m;
  for (i = 0; i < n; i++) {
    cin >> l >> r;
    for (j = l; j <= r; j++) arr[j]++;
  }
  int cnt = 0;
  for (i = 1; i <= m; i++)
    if (arr[i] == 0) cnt++;
  cout << cnt << endl;
  for (i = 1; i <= m; i++)
    if (arr[i] == 0) cout << i << " ";
  cout << endl;
  return 0;
}
