#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int t = 1;
  while (t--) {
    int m, n, l, r;
    scanf("%d", &n), scanf("%d", &m);
    vector<int> ans(m + 1, 0);
    bool flag = true;
    for (int i = 0; i < n; i++) {
      scanf("%d", &l), scanf("%d", &r);
      for (int j = l; j <= r; j++) ans[j] = 1;
      if (accumulate(ans.begin(), ans.end(), 0) == m) {
        flag = false;
        cout << "0";
        break;
      }
    }
    if (!flag) continue;
    int cnt = m - accumulate(ans.begin(), ans.end(), 0);
    cout << cnt << "\n";
    for (int i = 0; i < m + 1; i++)
      if (i && !ans[i]) cout << i << " ";
  }
}
