#include <bits/stdc++.h>
using namespace std;
const int M = 2e5 + 50;
bool vis[M];
int main() {
  int n, m, cnt = 0;
  scanf("%d %d", &n, &m);
  for (int i = 1; i <= n; i++) {
    int l, r;
    scanf("%d %d", &l, &r);
    for (int j = l; j <= r; j++) {
      if (!vis[j]) {
        cnt++;
      }
      vis[j] = 1;
    }
  }
  printf("%d\n", m - cnt);
  for (int i = 1; i <= m; i++) {
    if (!vis[i]) {
      printf("%d ", i);
    }
  }
}
