#include <bits/stdc++.h>
using namespace std;
int b[105];
int main() {
  int n, m;
  int x, y;
  while (scanf("%d %d", &n, &m) != EOF) {
    memset(b, -1, sizeof(b));
    int ans = m;
    for (int i = 1; i <= n; i++) {
      scanf("%d %d", &x, &y);
      if (x > y) {
        swap(x, y);
      }
      for (int i = x; i <= y; i++) {
        if (b[i] == -1) {
          ans--;
          b[i] = 0;
        }
      }
    }
    printf("%d\n", ans);
    for (int i = 1; i <= m; i++) {
      if (b[i] == -1) {
        printf("%d ", i);
      }
    }
    puts("");
  }
  return 0;
}
