#include <bits/stdc++.h>
int main() {
  int n, m, count = 0, i, j;
  scanf("%d", &n);
  int l[n], r[n];
  scanf("%d", &m);
  int num[m + 1];
  for (i = 0; i < n; i++) {
    scanf("%d %d", &l[i], &r[i]);
  }
  for (i = 1; i < m + 1; i++) {
    num[i] = i;
  }
  for (i = 0; i < n; i++) {
    for (j = l[i]; j <= r[i]; j++) {
      int k = 0;
      k = j;
      num[k] = 0;
    }
  }
  for (i = 1; i < m + 1; i++) {
    if (num[i] != 0) count++;
  }
  printf("%d\n", count);
  for (i = 1; i < m + 1; i++) {
    if (num[i] != 0) printf("%d ", num[i]);
  }
  return 0;
}
