#include <bits/stdc++.h>
using namespace std;
int h[1001];
int main() {
  int n, m, p, q, r;
  cin >> n >> m;
  for (int i = 1; i <= n; i++) {
    int a, b;
    cin >> a >> b;
    for (int j = a; j <= b; j++) h[j] = 1;
  }
  int sum = 0;
  sum = 0;
  sum = 0;
  for (int i = 1; i <= m; i++)
    if (h[i] != 1) sum++;
  cout << sum << "\n";
  int flag = 0;
  for (int i = 1; i <= m; i++)
    if (h[i] != 1) {
      if (flag == 0) {
        cout << i;
        flag = 1;
      } else
        cout << " " << i;
    }
  cout << "\n";
}
