You are given a set of $n$ segments on the axis $Ox$, each segment has integer endpoints between $1$ and $m$ inclusive. Segments may intersect, overlap or even coincide with each other. Each segment is characterized by two integers $l_i$ and $r_i$ ($1 \le l_i \le r_i \le m$) — coordinates of the left and of the right endpoints. 

Consider all integer points between $1$ and $m$ inclusive. Your task is to print all such points that don't belong to any segment. The point $x$ belongs to the segment $[l; r]$ if and only if $l \le x \le r$.


-----Input-----

The first line of the input contains two integers $n$ and $m$ ($1 \le n, m \le 100$) — the number of segments and the upper bound for coordinates.

The next $n$ lines contain two integers each $l_i$ and $r_i$ ($1 \le l_i \le r_i \le m$) — the endpoints of the $i$-th segment. Segments may intersect, overlap or even coincide with each other. Note, it is possible that $l_i=r_i$, i.e. a segment can degenerate to a point.


-----Output-----

In the first line print one integer $k$ — the number of points that don't belong to any segment.

In the second line print exactly $k$ integers in any order — the points that don't belong to any segment. All points you print should be distinct.

If there are no such points at all, print a single integer $0$ in the first line and either leave the second line empty or do not print it at all.


-----Examples-----
Input
3 5
2 2
1 2
5 5

Output
2
3 4 

Input
1 7
1 7

Output
0




-----Note-----

In the first example the point $1$ belongs to the second segment, the point $2$ belongs to the first and the second segments and the point $5$ belongs to the third segment. The points $3$ and $4$ do not belong to any segment.

In the second example all the points from $1$ to $7$ belong to the first segment.

Difficulty: EASY

Solutions:
(n, m) = map(int, input().split())
L = (m + 2) * [0]
for _ in range(n):
	(l, r) = map(int, input().split())
	L[l] += 1
	L[r + 1] -= 1
ans = []
for i in range(1, m + 1):
	L[i] += L[i - 1]
	if L[i] == 0:
		ans.append(i)
print(len(ans))
print(*ans)


(n, m) = map(int, input().split())
s = set(range(1, m + 1))
for i in range(n):
	(li, ri) = map(int, input().split())
	s -= set(range(li, ri + 1))
print(len(s))
print(*s)


x = [int(i) for i in input().split()]
l = [int(i) for i in range(1, x[1] + 1)]
for i in range(x[0]):
	a = [int(i) for i in input().split()]
	for j in range(a[0], a[1] + 1):
		if j in l:
			l.remove(j)
print(len(l))
print(*l)


(n, l) = [int(i) for i in input().split()]
counts = set()
counts_2 = set(range(1, l + 1))
for i in range(n):
	(k, m) = [int(i) for i in input().split()]
	seti = set(range(k, m + 1))
	counts = counts | seti
otv = sorted(list(counts_2.difference(counts)))
print(len(otv))
print(*otv)


(m, n) = map(int, input().split())
dic = {}
for i in range(n):
	dic[i + 1] = 0
for i in range(m):
	l = [int(x) for x in input().split()]
	for io in range(l[0], l[1] + 1):
		dic[io] += 1
xx = 0
abhishek = ''
for i in range(1, n + 1):
	if dic[i] == 0:
		xx += 1
		abhishek += str(i)
		abhishek += ' '
print(xx)
print(abhishek)


def points(arr, m):
	ans = []
	for i in range(1, m + 1):
		if i not in arr:
			ans.append(i)
	print(len(ans))
	for i in ans:
		print(i, '', end='')
	print()
(n, m) = list(map(int, input().rstrip().split()))
arr = set()
for i in range(n):
	(l, r) = list(map(int, input().rstrip().split()))
	for j in range(l, r + 1):
		arr.add(j)
points(list(arr), m)


(n, m) = map(int, input().split())
arr = [0] * (m + 1)
for i in range(n):
	(a, b) = map(int, input().split())
	for i in range(a, b + 1):
		arr[i] = 1
print(arr.count(0) - 1)
for i in range(1, m + 1):
	if arr[i] == 0:
		print(i, end=' ')


(n, k) = map(int, input().split())
(L, R) = ([], [])
for i in range(n):
	(x, y) = map(int, input().split())
	L.append(x)
	R.append(y)
X = []
for i in range(n):
	for j in range(L[i], R[i] + 1, 1):
		X.append(j)
S = [i for i in range(1, k + 1)]
S = set(S)
X = set(X)
r = list(S - X)
print(len(r))
for i in range(len(r)):
	print(r[i], end=' ')


(a, b) = input().split()
a = int(a)
b = int(b)
l = [1] * b
k = [0] * b
for i in range(a):
	(c, d) = input().split()
	c = int(c)
	d = int(d)
	l[c - 1:d] = k[c - 1:d]
ans = []
for i in range(len(l)):
	if l[i] == 1:
		ans.append(i + 1)
print(len(ans))
print(*ans)


(m, n) = list(map(int, input().split()))
s = dict()
for i in range(n):
	s[i + 1] = 0
for _ in range(m):
	t = list(map(int, input().split()))
	for i in range(t[0], t[1] + 1):
		s[i] += 1
r = [str(i) for i in s if not s[i]]
print(len(r))
print(' '.join(r) if len(r) else '')


def check(a, b, l):
	for i in range(a, b + 1):
		l.append(i)
	return l
(n, m) = map(int, input().split())
l = []
for _ in range(n):
	(a, b) = map(int, input().split())
	l = check(a, b, l)
l = list(set(l))
print(m - len(l))
for i in range(1, m + 1):
	if i not in l:
		print(i, end=' ')


(n, m) = list(map(int, input().split()))
temp = set(range(1, m + 1))
arr = []
for i in range(n):
	(l, r) = list(map(int, input().split()))
	temp = temp - set(range(l, r + 1))
print(len(temp))
print(*temp)


(n, m) = map(int, input().split())
a = []
count = 0
for i in range(1, m + 1):
	a.append(i)
for i in range(n):
	(l, r) = map(int, input().split())
	for j in range(l, r + 1):
		if j in a:
			a.remove(j)
		else:
			count += 1
print(len(a))
for i in a:
	print(i, end=' ')


i = lambda : map(int, input().split())
(n, m) = i()
s = lambda a, b: {*range(a, b + 1)}
v = s(1, m)
for _ in range(n):
	v -= s(*i())
print(len(v))
print(*v)


(n, m) = map(int, input().split())
l = [1] * m
for _ in range(n):
	(a, b) = map(int, input().split())
	for i in range(a - 1, b):
		l[i] = 0
print(sum(l))
for i in range(m):
	if l[i] == 1:
		print(i + 1, end=' ')
print('')


(n, k) = map(int, input().split())
l = [False] * (k + 1)
l[0] = True
for i in range(n):
	(x, y) = map(int, input().split())
	for i in range(x, y + 1):
		l[i] = True
print(l.count(False))
for i in range(len(l)):
	if l[i] == False:
		print(i, end=' ')


(n, m) = (int(x) for x in input().split())
a = [1] * (m + 1)
for i in range(n):
	(l, r) = (int(x) for x in input().split())
	for j in range(l, r + 1):
		a[j] = 0
print(sum(a) - 1)
if sum(a) - 1:
	for i in range(1, m + 1):
		if a[i] == 1:
			print(i, end=' ')


(a, b) = map(int, input().split())
n = [i for i in range(1, b + 1)]
v = []
for _ in range(a):
	(q, w) = map(int, input().split())
	for j in range(q, w + 1):
		if j not in v:
			v.append(j)
print(len(n) - len(v))
for i in n:
	if i not in v:
		print(i, end=' ')


(n, m) = map(int, input().split())
c = []
segmentos = []
for i in range(n):
	(l, r) = map(int, input().split())
	segmentos.append([l, r])
for j in range(1, m + 1):
	pertence = False
	for i in segmentos:
		if j >= i[0] and j <= i[1]:
			pertence = True
	if not pertence:
		c.append(j)
print(len(c))
for i in c:
	print(i, end=' ')
print()


(n, m) = map(int, input().split())
segs = []
for _ in range(n):
	(l, r) = map(int, input().split())
	segs.append((l, r))
ans = []
for x in range(1, m + 1):
	if not any((l <= x <= r for (l, r) in segs)):
		ans.append(str(x))
print(len(ans))
if ans:
	print(' '.join(ans))


(n, m) = map(int, input().split())
x = [0] * (m + 1)
for _ in range(n):
	(l, r) = map(int, input().split())
	for i in range(l, r + 1):
		x[i] = 1
c = x.count(0) - 1
print(c)
if c != 0:
	for i in range(m + 1):
		if x[i] == 0 and i != 0:
			print(i, end=' ')


(n, m) = map(int, input().split())
seg = [0] * (m + 1)
seg[0] = 1
for i in range(n):
	(a, b) = map(int, input().split())
	for j in range(a, b + 1):
		seg[j] = 1
rec = []
for i in range(m + 1):
	if seg[i] != 1:
		rec.append(i)
print(len(rec))
print(' '.join(map(str, rec)))


(n, m) = [int(x) for x in input().split()]
di = []
for i in range(n):
	(a, b) = [int(x) for x in input().split()]
	b += 1
	for ii in range(a, b):
		di.append(ii)
li = list(set(di))
if len(li) == m:
	print(0)
	print()
else:
	ans = ''
	count = 0
	for i in range(1, m + 1):
		if i not in li:
			ans += str(i) + ' '
			count += 1
	print(count)
	print(ans[:-1])


n = list(map(int, input().split()))
a = []
g = ''
h = list(('f' for i in range(n[1] + 1)))
for i in range(1, n[1] + 1):
	a.append(i)
for i in range(n[0]):
	s = list(map(int, input().split()))
	for i in range(s[0], s[1] + 1):
		if h[i] == 'f':
			a.remove(i)
			h[i] = 't'
print(len(a))
if not len(a) == 0:
	print(*a, sep=' ')


(n, m) = [int(x) for x in input().split()]
(minor, maximum) = (float('inf'), 0)
listC = set([])
for i in range(n):
	(a, b) = [int(x) for x in input().split()]
	listC = listC.union(set([i for i in range(a, b + 1)]))
listP = set([i for i in range(1, m + 1)])
listRes = listP - listC
print(len(listRes))
print(' '.join(map(str, list(listRes))))


(n, m) = map(int, input().split(' '))
t = n
l1 = [0] * (m + 1)
while t:
	(l, r) = map(int, input().split(' '))
	for i in range(l, r + 1):
		l1[i] += 1
	t -= 1
ct = 0
for i in range(1, m + 1):
	if l1[i] == 0:
		ct += 1
print(ct)
for i in range(1, m + 1):
	if l1[i] == 0:
		print(i, end=' ')


f = lambda : map(int, input().split())
(n, m) = f()
a = [0] * (m + 1)
for i in range(n):
	(l, r) = f()
	for i in range(l, r + 1):
		a[i] += 1
print(a.count(0) - 1)
b = []
for i in range(1, m + 1):
	if not a[i]:
		b.append(i)
print(*b)


seg = []
(n, m) = map(int, input().split())
for i in range(n):
	(l, r) = map(int, input().split())
	seg.append((l, r))
res = list(filter(lambda x: len(list(filter(lambda y: y[0] <= x <= y[1], seg))) == 0, range(1, m + 1)))
print(len(res))
print(*res)


def check(x):
	for i in range(n):
		if lr[i][0] <= x and x <= lr[i][1]:
			return False
	return True
(n, m) = map(int, input().split())
lr = [list(map(int, input().split())) for i in range(n)]
ans = list(filter(check, [i for i in range(1, m + 1)]))
print(len(ans))
print(*ans)


from itertools import accumulate
(n, m) = [int(c) for c in input().split()]
cnt = [0] * (m + 1)
for i in range(n):
	(li, ri) = [int(c) for c in input().split()]
	cnt[li - 1] += 1
	cnt[ri] -= 1
res = [str(i + 1) for (i, e) in enumerate(accumulate(cnt[:-1])) if e == 0]
print(len(res))
print(' '.join(res))


(n, m) = map(int, input().split())
used_points = [False] * (m + 1)
for ind in range(n):
	(l, r) = map(int, input().split())
	for point in range(l, r + 1):
		used_points[point] = True
count_not_used = 0
res = ''
for point in range(1, m + 1):
	if not used_points[point]:
		count_not_used += 1
		res += str(point) + ' '
print(count_not_used)
print(res)


(n, m) = input().split(' ')
n = int(n)
m = int(m)
v = [0] * (m + 1)
cnt = 0
ans = []
for i in range(n):
	(a, b) = input().split(' ')
	a = int(a)
	b = int(b)
	for j in range(a, b + 1):
		v[j] = 1
for i in range(1, m + 1):
	if v[i] == 0:
		cnt += 1
		ans.append(i)
print(cnt)
for x in ans:
	print(x, end=' ')


e = set()
f = set()
(a, b) = map(int, input().split())
for t in range(a):
	(c, d) = map(int, input().split())
	for i in range(c, d + 1):
		e.add(i)
		e.add(d)
for i in range(1, b + 1):
	f.add(i)
if len(e ^ f) == 0:
	print(0)
else:
	print(len(e ^ f))
	for i in e ^ f:
		print(i, end=' ')


(n, k) = map(int, input().split())
h = list(range(1, k + 1))
c = []
z = []
for i in list(range(n)):
	a = list(map(int, input().split()))
	x = 1
	for j in range(len(h)):
		if a[0] <= x <= a[1]:
			c.append(x)
			x += 1
		else:
			x += 1
for f in range(len(h)):
	if h[f] not in c:
		z.append(h[f])
print(len(z))
print(*z)


params = input().split()
rang = [i for i in range(1, eval(params[1]) + 1)]
for i in range(eval(params[0])):
	seg = input().split()
	for j in range(eval(seg[0]), eval(seg[1]) + 1):
		try:
			rang.remove(j)
		except ValueError:
			pass
if len(rang) == 0:
	print(0)
else:
	print(len(rang))
	st = ''
	for each in rang:
		st += str(each) + ' '
	print(st)


(a, b) = [int(x) for x in input('').split()]
i = 1
list = []
c = 1
d = 2
while i <= a:
	(c, d) = [int(y) for y in input('').split()]
	k = c
	while k <= d:
		if k not in list:
			list.append(k)
		k += 1
	i += 1
i = 1
p = 0
nlist = []
while i <= b:
	if i not in list:
		p = p + 1
		nlist.append(i)
	i = i + 1
print(p)
for x in nlist:
	print(x, end=' ')


(n, m) = map(int, input().split())
L = [0] * (m + 1)
for i in range(n):
	(l, r) = map(int, input().split())
	for j in range(l, r + 1):
		L[j] = 1
print(L[1:].count(0))
for i in range(1, m + 1):
	if L[i] == 0:
		print(i, end=' ')


s = input().split()
n = int(s[0])
m = int(s[1])
l = [0 for i in range(m)]
for i in range(n):
	s = input().split()
	le = int(s[0])
	ra = int(s[1])
	for j in range(le - 1, ra):
		l[j] += 1
print(l.count(0))
ll = []
for i in range(m):
	if l[i] == 0:
		ll.append(i + 1)
for i in range(len(ll) - 1):
	print(ll[i], end=' ')
if len(ll) > 0:
	print(ll[-1])


s = list(map(int, input().split()))
(n, m) = (s[0], s[1])
cl = []

def check(x):
	res = True
	for r in cl:
		if x >= r[0] and x <= r[1]:
			res = False
			break
	return res
for i in range(n):
	cl.append(list(map(int, input().split())))
res = []
for i in range(1, m + 1):
	if check(i):
		res.append(i)
print(len(res))
if len(res) != 0:
	print(*res)


(n, k) = map(int, input().split())
coordinates = [z for z in range(1, k + 1)]
for _ in range(n):
	(x, y) = map(int, input().split())
	covered = [z for z in range(x, y + 1)]
	coordinates = set(coordinates) - set(covered)
print(len(coordinates))
if len(coordinates) != 0:
	print(*coordinates)


(n, u) = map(int, input().split())
l = [0] * (u + 3)
for i in range(n):
	(a, b) = map(int, input().split())
	l[a] += 1
	l[b + 1] -= 1
for i in range(1, u + 1):
	l[i] += l[i - 1]
ans = []
c = 0
for i in range(1, u + 1):
	if l[i] == 0:
		ans.append(i)
		c += 1
print(c)
if len(ans) > 0:
	print(*ans)


(n, m) = input().split()
seg_numbers = set()
for _ in range(int(n)):
	seg = input().split()
	for i in range(int(seg[0]), int(seg[1]) + 1):
		seg_numbers.add(i)
lista = [str(i) for i in range(1, int(m) + 1) if i not in seg_numbers]
print(len(lista))
print(' '.join(lista))


(n, m) = map(int, input().split())
a = [0] * m
for i in range(n):
	(x, y) = map(int, input().split())
	for j in range(x, y + 1):
		a[j - 1] = 1
k = 0
r = []
for i in range(m):
	if a[i] == 0:
		k += 1
		r.append(i + 1)
print(k)
print(*r)


(n, m) = map(int, input().split(' '))
list1 = list(range(1, m + 1))
for j in range(n):
	(l, r) = map(int, input().split(' '))
	for j in range(l, r + 1):
		list1[j - 1] = None
print(m - list1.count(None))
for j in list1:
	if j != None:
		print(j, end=' ')


nm = input().split(' ')
n = int(nm[0])
m = int(nm[1])
starts = []
ends = []
coords = {}
for i in range(n):
	k = input().split(' ')
	starts.append(int(k[0]))
	ends.append(int(k[1]))
for p in starts:
	if coords.get(p) is None:
		coords[p] = 1
	else:
		coords[p] = coords[p] + 1
for p in ends:
	if coords.get(p) is None:
		coords[p] = -1
	else:
		coords[p] = coords[p] - 1
lines = 0
ans = []
for i in range(1, m + 1):
	if coords.get(i) is not None:
		if coords[i] > 0:
			lines += coords[i]
		elif coords[i] == 0:
			lines += 1
	if lines == 0:
		ans.append(i)
	if coords.get(i) is not None:
		if coords[i] < 0:
			lines += coords[i]
		elif coords[i] == 0:
			lines -= 1
print(len(ans))
if len(ans) > 0:
	for p in ans:
		print(p, end=' ')


(n, m) = map(int, input().split())
ar = [i for i in range(1, m + 1)]
for i in range(n):
	(l, r) = map(int, input().split())
	for k in range(l, r + 1):
		try:
			ar.remove(k)
		except:
			pass
print(len(ar))
print(' '.join([str(i) for i in ar]))


(n, m) = map(int, input().split(' '))
cnt = [0] * (m + 2)
for _ in range(n):
	(l, r) = map(int, input().split(' '))
	cnt[l] += 1
	cnt[r + 1] -= 1
for i in range(1, m + 1):
	cnt[i] += cnt[i - 1]
ans = []
for i in range(1, m + 1):
	if cnt[i] == 0:
		ans.append(i)
print(len(ans))
for x in ans:
	print(x, end=' ')


a = input().split()
n = int(a[0])
m = int(a[1])
s = []
for i in range(1, m + 1):
	s += [i]
for i in range(n):
	l = -1
	r = -1
	a = input().split()
	a1 = int(a[0])
	a2 = int(a[1])
	for j in range(len(s)):
		if l == -1 and s[j] >= a1:
			l = j
		if l != -1 and s[j] > a2:
			r = j
			break
	if l == -1:
		s = s
	elif r == -1:
		s = s[:l]
	else:
		s = s[:l] + s[r:]
	if len(s) == 0:
		break
print(len(s))
for i in s:
	print(i, end=' ')


(n, m) = map(int, input().split())
c = [0] * (m + 1)
for i in range(n):
	(l, r) = map(int, input().split())
	for j in range(l, r + 1):
		c[j] = 1
ans = []
for i in range(1, len(c)):
	if c[i] == 0:
		ans.append(i)
print(len(ans))
for i in range(len(ans)):
	print(ans[i], end=' ')


(n, m) = map(int, input().split())
cnt = [0] * (m + 2)
for _ in range(n):
	(l, r) = map(int, input().split())
	cnt[l] += 1
	cnt[r + 1] -= 1
from itertools import accumulate
nsegments = list(accumulate(cnt))
bad = [x + 1 for (x, nn) in enumerate(nsegments[1:m + 1]) if not nn]
print(len(bad))
print(*bad)


(n, m) = tuple(map(int, input().split()))
points = [True for k in range(m)]
for k in range(n):
	(l, r) = tuple(map(int, input().split()))
	for i in range(l - 1, r):
		points[i] = False
output = []
for i in range(m):
	if points[i]:
		output.append(i + 1)
print(len(output))
print(' '.join(map(str, output)))


(n, m) = map(int, input().split())
segs = []
for i in range(n):
	(l, r) = map(int, input().split())
	segs.append((l, r))
points = []
for i in range(1, m + 1):
	for j in segs:
		if i >= j[0] and i <= j[1]:
			break
	else:
		points.append(i)
print(len(points))
print(' '.join((str(x) for x in points)))


from itertools import *
R = lambda : map(int, input().split())
(n, m) = R()
a = [0] * (m + 1)
for _ in [0] * n:
	(l, r) = R()
	a[l - 1] += 1
	a[r] -= 1
b = [i for (i, x) in enumerate(accumulate(a[:-1]), 1) if x == 0]
print(len(b))
print(*b)


a = input().split()
n = int(a[0])
m = int(a[1])
arr = []
for i in range(1, m + 1):
	arr.append(i)
for i in range(n):
	t = input().split()
	x = int(t[0])
	y = int(t[1])
	for k in range(x, y + 1):
		if k in arr:
			arr.remove(k)
			m -= 1
ss = ''
for i in arr:
	ss += str(i) + ' '
print(m)
print(ss[:-1])


(n, m) = map(int, input().split())
A = [0] * (m + 1)
for i in range(n):
	(l, r) = map(int, input().split())
	for i in range(l, r + 1):
		A[i] += 1
k = A.count(0) - 1
print(k)
for i in range(1, m + 1):
	if A[i] == 0:
		print(i, end=' ')


infos = input()
info = infos.split()
n = int(info[0])
m = int(info[1])
full = [i for i in range(1, m + 1)]
for i in range(n):
	segs = input()
	seg = segs.split()
	seg1 = int(seg[0])
	seg2 = int(seg[1])
	for j in range(seg1, seg2 + 1):
		if j in full:
			full.remove(j)
L = len(full)
print(L)
if L != 0:
	full = map(str, full)
	print(' '.join(full))


(n, m) = map(int, input().split())
area = []
point = [0] * (m + 1)
for i in range(n):
	(x, y) = map(int, input().split())
	area.append([x, y])
for j in range(1, m + 1):
	for i in range(n):
		if area[i][0] <= j <= area[i][1]:
			point[j] = 1
print(m - sum(point))
for j in range(1, m + 1):
	if point[j] == 0:
		print(str(j) + ' ', end='')


(n, m) = map(int, input().split())
x = [0 for _ in range(m + 1)]
for i in range(n):
	(l, r) = map(int, input().split())
	for j in range(l, r + 1):
		x[j] = 1
ans = []
for i in range(1, m + 1):
	if x[i] == 0:
		ans.append(i)
print(len(ans))
print(' '.join(map(str, ans)))


(n, m) = map(int, input().split(' '))
arr = []
res = []
for i in range(n):
	(a, b) = map(int, input().split(' '))
	arr1 = list(range(a, b + 1))
	arr += arr1
for i in range(1, m + 1):
	if i not in arr:
		res.append(i)
if len(res) == 0:
	print(0)
else:
	print(len(res))
	print(*res)


(n, m) = (int(_) for _ in input().split(' '))
points = set(range(1, m + 1))
for _ in range(0, n):
	(l, r) = (int(_) for _ in input().split(' '))
	points = points - set(range(l, r + 1))
print(len(points))
print(' '.join((str(p) for p in points)))


import sys
input = lambda : sys.stdin.readline().rstrip('\r\n')
Read = lambda : list(map(int, input().split()))
Num = lambda : int(input())

def solve():
	(n, m) = Read()
	ok = [True] * m
	for _ in range(n):
		(a, b) = Read()
		for i in range(a - 1, b):
			ok[i] = False
	print(ok.count(True))
	for i in range(m):
		if ok[i]:
			print(i + 1, end=' ')
	print()
solve()


l = input().split()
n = int(l[0])
m = int(l[1])
count = 0
b = []
a = []
for i in range(n):
	temp = input().split()
	a.append([int(temp[0]), int(temp[1])])
for i in range(m):
	true = 0
	for j in range(n):
		if i + 1 < a[j][0] or i + 1 > a[j][1]:
			true = true + 1
	if true >= n:
		count += 1
		b.append(i + 1)
print(count)
print(*b)


(n, m) = map(int, input().split())
begins = [1] * (m + 1)
ends = [1] * (m + 1)
cnt = 1
while cnt <= n:
	(l, r) = map(int, input().split())
	begins[l] += 1
	ends[r] += 1
	cnt += 1
res = []
i = 1
segments = 1
while i <= m:
	segments += begins[i]
	if segments == 2:
		res.append(i)
	segments -= ends[i]
	i += 1
print(len(res))
print(*res)


(s, k) = list(map(int, input().split()))
tam = []
sam = []
kam = list(range(1, k + 1))
for x in range(s):
	(po, lo) = list(map(int, input().split()))
	olk = list(range(po, lo + 1))
	for item in olk:
		tam.append(item)
for item in kam:
	if item not in tam:
		sam.append(item)
	else:
		pass
print(len(sam))
print(*sam)


print((lambda n, m, process, print_ans: print_ans(process(n, m, [tuple(map(int, input().split())) for _ in range(n)])))(*map(int, input().split()), lambda n, m, a: [i for i in range(1, m + 1) if all((i < f[0] or i > f[1] for f in a))], lambda ans: str(len(ans)) + '\n' + ' '.join(map(str, ans))))


s = input().split(' ')
(nSegs, m) = (int(s[0]), int(s[1]))
segs = []
for i in range(nSegs):
	s = input().split(' ')
	segs.append([int(s[0]), int(s[1])])
puntsOcupats = []
for seg in segs:
	for i in range(seg[0], seg[1] + 1):
		if not i in puntsOcupats:
			puntsOcupats.append(i)
k = 0
points = []
for i in range(1, m + 1):
	if not i in puntsOcupats:
		points.append(i)
		k += 1
print(k)
for p in points:
	print(p, end=' ')


(n, m) = list(map(int, input().split()))
used = [0 for _ in range(m + 1)]
for i in range(n):
	(l, r) = list(map(int, input().split()))
	for j in range(l, r + 1):
		used[j] = 1
ans = len([c for c in used if c == 0])
print(ans - 1)
for i in range(1, m + 1):
	if used[i] == 0:
		print(i, end=' ')


(n, m) = list(map(int, input().split()))
a = []
for _ in range(n):
	a.append(list(map(int, input().split())))
ps = []
for i in range(1, m + 1):
	pr = False
	for (l, r) in a:
		if l <= i and r >= i:
			pr = True
	if not pr:
		ps.append(i)
print(len(ps))
for i in ps:
	print(i, end=' ')
print()


(n, k) = map(int, input().split())
li = set(range(1, k + 1))
for _ in range(n):
	(a, b) = map(int, input().split())
	for i in range(a, b + 1):
		li.discard(i)
print(len(li))
print(' '.join(map(str, li)))


(n, m) = [int(s) for s in input().split()]
a = set()
for i in range(1, m + 1):
	a.add(i)
for i in range(n):
	(l, r) = [int(s) for s in input().split()]
	for j in range(l, r + 1):
		if j in a:
			a.discard(j)
print(len(a))
for ii in a:
	print(ii, end=' ')


(n, m) = map(int, input().split())
a = [0] * (m + 2)
while n:
	n -= 1
	(l, r) = map(int, input().split())
	r += 1
	a[l] += 1
	a[r] -= 1
i = 1
b = []
while i <= m:
	a[i] += a[i - 1]
	if a[i] == 0:
		b.append(i)
	i += 1
print(len(b))
print(*b)


(a, b) = map(int, input().split())
x = []
x1 = []
x2 = []
z = 0
for i in range(a):
	(c, d) = map(int, input().split())
	for i in range(d - c + 1):
		x.append(c)
		c += 1
for i in range(b):
	x1.append(i + 1)
for i in range(len(x1)):
	if x1[i] not in x:
		z += 1
		x2.append(x1[i])
print(z)
print(*x2)


(n, m) = map(int, input().split())
a = [1] * (m + 1)
a[0] = 0
for i in range(n):
	(l, r) = map(int, input().split())
	for j in range(l, r + 1):
		a[j] = 0
res = []
for i in range(m + 1):
	if a[i] == 1:
		res.append(i)
print(len(res))
print(*res)


(n, u) = map(int, input().split()[:2])
a = []
for i in range(n):
	(p, q) = map(int, input().split()[:2])
	a.extend(list(range(p, q + 1)))
a = set(a)
b = list(range(1, u + 1))
b = set(b)
k = b - a
print(len(k))
for i in k:
	print(i, end=' ')


from itertools import accumulate
from sys import stdin
all_in = stdin.readlines()
(n, m) = map(int, all_in[0].split())
p = [tuple(map(int, el.split())) for el in all_in[1:]]
a = [0] * (m + 1)
for el in p:
	a[el[0] - 1] += 1
	a[el[1]] -= 1
acc = list(accumulate(a))
print(acc.count(0) - 1)
print(' '.join(map(str, [i + 1 for i in range(m) if acc[i] == 0])))


(nos, maxs) = [int(x) for x in input().split()]
points = [0] * (maxs + 1)
points[0] = 0
for i in range(nos):
	(st, en) = [int(x) for x in input().split()]
	for j in range(st, en + 1):
		points[j] = 1
sums = sum([1 for x in points[1:] if x == 0])
print(sums)
for (i, v) in enumerate(points[1:]):
	if v == 0:
		print(i + 1, end=' ')


(n, m) = map(int, input().split())
c = 0
z = 0
otrezki = []
answer = []
while c < n:
	(l, r) = map(int, input().split())
	if l == r:
		otrezki.append(l)
		c += 1
	else:
		while l <= r:
			otrezki.append(l)
			l += 1
		c += 1
for i in range(1, m + 1):
	if i not in otrezki:
		answer.append(str(i))
print(len(answer))
print(' '.join(answer))


def main():
	(n, m) = map(int, input().split())
	seg = []
	for _ in range(n):
		(a, b) = map(int, input().split())
		seg.append((a, b))
	res = []
	for i in range(1, m + 1):
		ok = True
		for s in seg:
			if s[0] <= i <= s[1]:
				ok = False
				break
		if ok:
			res.append(i)
	print(len(res))
	print(*res)
main()


from collections import defaultdict
(n, m) = [int(i) for i in input().split()]
x = [True for i in range(m + 1)]
x[0] = False
for i in range(n):
	(a, b) = [int(i) for i in input().split()]
	for j in range(a, b + 1):
		x[j] = False
print(x.count(True))
s = ''
for i in range(m + 1):
	if x[i]:
		s += str(i)
		s += ' '
print(s)


(n, lim) = map(int, input().split(' '))
s = set(range(1, lim + 1))
for _ in range(n):
	(a, b) = map(int, input().split(' '))
	s -= set(range(a, b + 1))
print(len(s))
print(' '.join(map(str, s)))


(n, m) = map(int, input().split())
L = [0] * m
for k in range(n):
	(a, b) = map(int, input().split())
	for i in range(a, b + 1):
		L[i - 1] = 1
L = [str(k + 1) for k in range(m) if L[k] == 0]
print(len(L))
if len(L):
	print(' '.join(L))


def intmaker(arg):
	return list(map(int, arg.split()))
(q_seg, max_x) = intmaker(input())
occupied = set()
for _ in range(q_seg):
	(l, r) = intmaker(input())
	occupied |= set(range(l, r + 1))
vacant = set(range(1, max_x + 1)) - occupied
print(len(vacant))
print(*vacant)


(n, m) = map(int, input().split())
s = set()
for i in range(n):
	(l, r) = map(int, input().split())
	for j in range(l, r + 1):
		s.add(j)
a = list(s)
a.sort()
res = list()
for i in range(1, m + 1):
	if i not in a:
		res.append(i)
print(len(res))
for i in res:
	print(i, end=' ')


(n, m) = list(map(int, input().split()))
a = []
b = [_ + 1 for _ in range(m)]
for i in range(n):
	(s, d) = map(int, input().split())
	for h in range(d - s + 1):
		if s + h - 1 not in a:
			a.append(s + h - 1)
a.sort()
a.reverse()
for f in range(len(a)):
	b.pop(a[f])
print(len(b))
print(*b)


(n, m) = input().strip().split(' ')
n = int(n)
m = int(m)
intervals = []
for i in range(n):
	(l, r) = input().strip().split(' ')
	intervals.append((int(l), int(r)))
marked = [0] * (m + 1)
for interval in intervals:
	for j in range(interval[0], interval[1] + 1):
		marked[j] = 1
count = 0
numbers = []
marked = marked[1:]
for i in range(m):
	if marked[i] == 0:
		count += 1
		numbers.append(i + 1)
print(count)
for n in numbers:
	print(n, end=' ')


(n, m) = (int(x) for x in input().split())
mas = [1] * m
count = 0
for i in range(n):
	(l, r) = (int(x) for x in input().split())
	for j in range(l - 1, r):
		if mas[j] != 0:
			mas[j] = 0
			count += 1
print(len(mas) - count)
for i in range(len(mas)):
	if mas[i] == 1:
		print(i + 1, end=' ')


(n, r) = input().split()
(n, r) = (int(n), int(r))
r = list(range(1, r + 1))
c = []
while n > 0:
	(l, u) = input().split()
	(l, u) = (int(l), int(u))
	for i in r:
		if i >= l and i <= u:
			c.append(i)
	n -= 1
res = []
for j in r:
	if j not in c:
		res.append(j)
print(len(res))
for k in res:
	print(k, end=' ')


str1 = input()
n = int(str1.split()[0])
m = int(str1.split()[1])
lst = []
point = []
for i in range(n):
	lst1 = list(map(int, input().split()))
	lst.append(lst1)
for i in range(1, m + 1):
	for j in range(n):
		if i >= lst[j][0] and i <= lst[j][1]:
			break
	else:
		point.append(i)
print(len(point))
for i in point:
	print(i, end=' ')


(n, m) = map(int, input().split())
L = []
S = []
p = []
k = 0
for i in range(n):
	s = list(map(int, input().split()))
	L += s
for i in range(0, len(L), 2):
	for j in range(L[i], L[i + 1] + 1):
		S += [j]
for i in range(1, m + 1):
	if i not in S:
		k += 1
		p += [i]
if k != 0:
	print(k)
	for i in p:
		print(i, end=' ')
else:
	print(0)


(n, m) = map(int, input().split())
imos = [0 for i in range(m + 10)]
for i in range(n):
	(a, b) = map(int, input().split())
	imos[a] += 1
	imos[b + 1] -= 1
ans = list()
for i in range(1, m + 1):
	imos[i] += imos[i - 1]
	if imos[i] == 0:
		ans.append(i)
print(len(ans))
for i in ans:
	print(i, end=' ')
print('')


(n, m) = map(int, input().split())
l = [0] * n
r = [0] * n
for i in range(n):
	(l[i], r[i]) = map(int, input().split())
s = []
for i in range(1, m + 1):
	k = 0
	for j in range(n):
		if l[j] > i or i > r[j]:
			k += 1
	if k == n:
		s.append(i)
print(len(s))
print(*s)


(out, inte, lst) = ([], [], [])
(n, u_b) = map(int, input().split(' '))
for i in range(n):
	(a, b) = map(int, input().split(' '))
	while a <= b:
		lst.append(a)
		a += 1
for j in range(1, u_b + 1):
	inte.append(j)
for k in inte:
	if k not in lst:
		out.append(k)
print(len(out))
for x in out:
	print(x, end=' ')


(n, m) = map(int, input().strip().split())
l1 = [0 for i in range(m + 1)]
for i in range(n):
	(l, r) = map(int, input().strip().split())
	for j in range(l, r + 1):
		l1[j] = 1
count = 0
ans = []
for i in range(1, m + 1):
	if l1[i] == 0:
		count = count + 1
		ans.append(i)
print(count)
for i in ans:
	print(i, end=' ')


(n, m) = map(int, input().split())
used = [False] * (m + 1)
for i in range(n):
	(l, r) = map(int, input().split())
	for j in range(l, r + 1):
		used[j] = True
ans = 0
A = [0] * (m + 1)
for i in range(1, m + 1):
	if not used[i]:
		A[ans] = i
		ans += 1
print(ans)
print(*A[:ans])


(n, m) = map(int, input().strip().split())
points = set((i for i in range(1, m + 1)))
for i in range(n):
	(l, r) = map(int, input().strip().split())
	for j in range(l, r + 1):
		if j in points:
			points.remove(j)
print(len(points))
if len(points) > 0:
	print(' '.join(map(str, points)))


(n, m) = [int(x) for x in input().split(' ')]
seg = set()
points = set(range(1, m + 1))
for i in range(n):
	(x, y) = [int(x) for x in input().split(' ')]
	for j in range(x, y + 1):
		seg.add(j)
points = points - seg
l = len(points)
if l > 0:
	print(l)
	print(*list(points))
else:
	print(0)


a = list(map(int, input().split()))
n = a[0]
m = a[1]
ans = []
segments = []
for i in range(n):
	segments.append(list(map(int, input().split())))
for i in range(1, m + 1):
	for segment in segments:
		if segment[0] <= i <= segment[1]:
			break
	else:
		ans.append(i)
print(len(ans))
print(*ans)


def fill(i, j):
	for i in range(i, j):
		d[i] = True
(n, m) = map(int, input().split())
d = [False for i in range(m)]
for i in range(n):
	(l, r) = map(int, input().split())
	l -= 1
	fill(l, r)
ans = []
for i in range(m):
	if not d[i]:
		ans.append(i + 1)
print(len(ans))
print(*ans)


(n, m) = [int(j) for j in input().split()]
seg = [[int(j) for j in input().split()] for k in range(n)]
s = set()
for i in range(n):
	for j in range(seg[i][0], seg[i][1] + 1):
		s.add(j)
print(m - len(s))
for i in range(1, m + 1):
	if i not in s:
		print(i, end=' ')


(n, m) = map(int, input().split())
cnt = [0] * (m + 1)
ans = m
for _ in range(n):
	(l, r) = map(int, input().split())
	for x in range(l, r + 1):
		if cnt[x] == 0:
			cnt[x] = 1
			ans = ans - 1
print(ans)
for x in range(1, m + 1):
	if cnt[x] == 0:
		print(x, end=' ')


(n, m) = map(int, input().split())
a = []
for i in range(n):
	a.append(list(map(int, input().split())))
cnt = 0
ans = []
for i in range(1, m + 1):
	F = False
	for j in range(n):
		if a[j][0] <= i <= a[j][1]:
			F = True
	if F == False:
		cnt += 1
		ans.append(i)
print(cnt)
print(*ans)


(n, m) = [int(x) for x in input().split()]
all = set(list(range(1, m + 1)))
und = set()
for _ in range(n):
	(l, r) = [int(x) for x in input().split()]
	und.update(set(range(l, r + 1)))
res = all.difference(und)
print(len(res))
print(*res)


a = [int(x) for x in input().split()]
n = a[0]
m = a[1]
res = [1 for i in range(m)]
for i in range(n):
	b = [int(x) for x in input().split()]
	for i in range(b[0] - 1, b[1]):
		res[i] = 0
print(sum(res))
for i in range(len(res)):
	if res[i] != 0:
		print(i + 1, end=' ')


(n, m) = map(int, input().split())
s = []
for i in range(n):
	s.append([int(i) for i in input().split()])
k = [i for i in range(0, m + 1)]
for i in s:
	for j in range(i[0], i[1] + 1):
		k[j] = -1
ans = 0
ans_s = ''
for i in k:
	if i > 0:
		ans += 1
		ans_s += str(i) + ' '
print(ans)
print(ans_s)


from collections import deque, Counter, OrderedDict
from heapq import nsmallest, nlargest
from math import ceil, floor, log, log2, sqrt, gcd, factorial, pow

def binNumber(n, size=4):
	return bin(n)[2:].zfill(size)

def iar():
	return list(map(int, input().split()))

def ini():
	return int(input())

def isp():
	return map(int, input().split())

def sti():
	return str(input())

def par(a):
	print(' '.join(list(map(str, a))))

def tdl(outerListSize, innerListSize, defaultValue=0):
	return [[defaultValue] * innerListSize for i in range(outerListSize)]

class pair:

	def __init__(self, f, s):
		self.fi = f
		self.se = s

	def __lt__(self, other):
		return (self.fi, self.se) < (other.fi, other.se)
(n, m) = isp()
arr = [0] * (m + 1)
for _ in range(n):
	(a, b) = isp()
	for i in range(a, b + 1):
		arr[i] = 1
a = []
s = 0
for i in range(1, m + 1):
	if arr[i] == 0:
		s += 1
		a.append(i)
print(s)
par(a)


(n, m) = map(int, input().split())
val = [0 for i in range(0, m + 1)]
for j in range(n):
	(l, r) = map(int, input().split())
	for i in range(l, r + 1):
		val[i] += 1
s = ''
ans = 0
for i in range(1, m + 1):
	if val[i] == 0:
		s += str(i) + ' '
		ans += 1
if ans != 0:
	print(ans)
	print(s)
else:
	print('0')


g = list(map(int, input().split(' ')))
(n, m) = g
l1 = []
c = 0
l2 = []
for i in range(n):
	l = list(map(int, input().split(' ')))
	(a, b) = l
	for k in range(a, b + 1):
		l1.append(k)
for i in range(1, m + 1):
	if i not in l1:
		c = c + 1
		l2.append(i)
print(c)
if c != 0:
	for i in l2:
		print(i, end=' ')


(n, m) = [int(i) for i in input().split()]
s = set()
for i in range(n):
	(a, b) = [int(i) for i in input().split()]
	for j in range(a, b + 1):
		s.add(j)
if len(s) == m:
	print(0)
else:
	print(m - len(s))
	for j in range(1, m + 1):
		if j not in s:
			print(j, end=' ')


(n, m) = map(int, input().split())
arr = []
for i in range(n):
	(x, y) = map(int, input().split())
	if x == y:
		arr.append(x)
	for j in range(x, y + 1):
		arr.append(j)
ans = []
for i in range(1, m + 1):
	if i in arr:
		continue
	ans.append(i)
print(len(ans))
print(*ans)


R = lambda : map(int, input().strip().split())
(n, m) = R()
li = [True] * (m + 5)
for x in range(n):
	(l, r) = R()
	li[l:r + 1] = [False] * (r - l + 1)
ans = []
for y in range(1, m + 1):
	if li[y] == True:
		ans.append(y)
print(len(ans))
print(*ans)


(n, m) = map(int, input().split())
k = [i for i in range(1, m + 1)]
l = []
for i in range(n):
	(x, y) = map(int, input().split())
	for i in range(x, y + 1):
		l.append(i)
a = set(k) - set(l)
print(len(a))
print(*list(a))


(n, m) = map(int, input().split(' '))
visited = set()
for _ in range(n):
	(l, r) = map(int, input().split(' '))
	for x in range(l, r + 1):
		visited.add(x)
res = []
for x in range(1, m + 1):
	if x not in visited:
		res.append(x)
print(len(res))
for x in res:
	print(x, end=' ')


(n, m) = list(map(int, input().split()))
remain = set(range(1, m + 1))
for _ in range(n):
	(l, r) = list(map(int, input().split()))
	for i in range(l, r + 1):
		remain.discard(i)
print(len(remain))
print(*sorted(remain))


(n, m) = list(map(int, input().split(' ')))
points = [[x, False] for x in range(1, m + 1)]
endpoints = []
for i in range(n):
	(l, r) = list(map(int, input().split(' ')))
	for i in range(l - 1, r):
		points[i][1] = True
free = [str(x[0]) for x in points if x[1] == False]
print(len(free))
print(' '.join(free))


(n, m) = [int(x) for x in input().split()]
answer = [x for x in range(1, m + 1)]
for i in range(n):
	(a, b) = [int(x) for x in input().split()]
	for j in range(a, b + 1):
		if j in answer:
			answer.remove(j)
print(len(answer))
for x in answer:
	print(x, end=' ')


(n, m) = map(int, input().split())
l = [0] * n
r = [0] * n
count = 0
flag = 1
rez = []
for i in range(n):
	(l[i], r[i]) = map(int, input().split())
for j in range(1, m + 1):
	for i in range(n):
		if j >= l[i] and j <= r[i]:
			flag = 0
			break
	if flag == 1:
		rez.append(j)
		count += 1
	else:
		flag = 1
print(count)
for i in range(count):
	print(rez[i], end=' ')


i = lambda : map(int, input().split())
(x, n) = i()
list1 = []
for i in range(0, x):
	r = input()
	(x1, x2) = (int(r.split()[0]), int(r.split()[1]))
	for x in range(x1, x2 + 1):
		if not x in list1:
			list1.append(x)
list2 = range(1, n + 1)
list3 = list(set(list2).difference(set(list1)))
import sys
if len(list3) != 0:
	print(len(list3))
	for x in list3:
		if x != list3[-1]:
			sys.stdout.write(str(x) + ' ')
		else:
			sys.stdout.write(str(x))
else:
	print(0)


from sys import stdin, stdout
import bisect
import math
from collections import Counter

def st():
	return list(stdin.readline().strip())

def inp():
	return int(stdin.readline())

def li():
	return list(map(int, stdin.readline().split()))

def mp():
	return map(int, stdin.readline().split())

def pr(n):
	stdout.write(str(n) + '\n')

def soe(limit):
	l = [1] * (limit + 1)
	prime = []
	for i in range(2, limit + 1):
		if l[i]:
			for j in range(i * i, limit + 1, i):
				l[j] = 0
	for i in range(2, limit + 1):
		if l[i]:
			prime.append(i)
	return prime

def segsoe(low, high):
	limit = int(high ** 0.5) + 1
	prime = soe(limit)
	n = high - low + 1
	l = [0] * (n + 1)
	for i in range(len(prime)):
		lowlimit = low // prime[i] * prime[i]
		if lowlimit < low:
			lowlimit += prime[i]
		if lowlimit == prime[i]:
			lowlimit += prime[i]
		for j in range(lowlimit, high + 1, prime[i]):
			l[j - low] = 1
	for i in range(low, high + 1):
		if not l[i - low]:
			if i != 1:
				print(i)

def power(a, n):
	r = 1
	while n:
		if n & 1:
			r = r * a
			n = n - 1
		else:
			a = a * a
			n = n >> 1
	return r

def solve():
	(n, m) = mp()
	l = [0] * m
	for i in range(n):
		(a, b) = mp()
		for i in range(a - 1, b):
			l[i] = 1
	pr(l.count(0))
	for i in range(m):
		if l[i] == 0:
			print(i + 1, end=' ')
for _ in range(1):
	solve()


from sys import stdin

def arr_inp(n):
	if n == 1:
		return [int(x) for x in stdin.readline().split()]
	elif n == 2:
		return [float(x) for x in stdin.readline().split()]
	else:
		return list(stdin.readline()[:-1])
(n, m) = arr_inp(1)
mem = [0] * (m + 1)
for i in range(n):
	(l, r) = arr_inp(1)
	for j in range(l, r + 1):
		mem[j] = 1
all = []
for i in range(1, m + 1):
	if not mem[i]:
		all.append(i)
print(len(all))
print(*all)


(n, m) = map(int, input().split())
a = [0] * m
k = 0
for i in range(n):
	(x, t) = map(int, input().split())
	x -= 1
	for j in range(x, t):
		a[j] = 1
b = []
for i in range(m):
	if a[i] == 0:
		b.append(i + 1)
print(len(b))
if len(b) != 0:
	print(*b)


(n, m) = [int(x) for x in input().split(' ')]

def go():
	points = [1] * m
	for i in range(n):
		(l, r) = [int(x) for x in input().split(' ')]
		for j in range(l, r + 1):
			points[j - 1] = 0
	print(sum(points))
	print(' '.join([str(x + 1) for x in range(m) if points[x] == 1]))
go()


(n, m) = map(int, input().split())
clr = [0] * (m + 1)
for i in range(n):
	(l, r) = map(int, input().split())
	for j in range(l, r + 1):
		clr[j] = 1
print(m - sum(clr))
for i in range(1, m + 1):
	if clr[i] == 0:
		print(i, end=' ')


(n, m) = map(int, input().split())
s = set()
s1 = set()
for i in range(n):
	(l, r) = map(int, input().split())
	for j in range(l, r + 1):
		s.add(j)
for i in range(1, m + 1):
	s1.add(i)
r = len(s1 - s)
print(r)
if r > 0:
	for i in s1 - s:
		print(i, end=' ')


(n, m) = map(int, input().split(' '))
cek = [0 for i in range(m + 1)]
ans = []
for i in range(n):
	(a, b) = map(int, input().split(' '))
	for j in range(a, b + 1):
		cek[j] += 1
for i in range(1, m + 1):
	if cek[i] == 0:
		ans.append(i)
print(len(ans))
for i in ans:
	print(i, end=' ')


(n, m) = map(int, input().split())
axis = [1 for _ in range(m)]
for _ in range(n):
	(l, r) = map(int, input().split())
	for i in range(l - 1, r):
		axis[i] = 0
print(sum(axis))
for (ix, val) in enumerate(axis):
	if val:
		print(ix + 1, end=' ')


(n, m) = map(int, input().split())
lst = [[int(x), 0] for x in range(0, m + 1)]
for i in range(n):
	(lo, hi) = map(int, input().split())
	for j in range(lo, hi + 1):
		lst[j][1] = 1
s = 0
points = []
for i in range(1, m + 1):
	if lst[i][1] == 0:
		s += 1
		points.append(i)
print(s)
if s != 0:
	for x in points:
		print(x, end=' ')


(n, m) = map(int, input().split())
l = list(range(1, m + 1))
for i in range(n):
	(li, r) = map(int, input().split())
	if len(l) == 0:
		continue
	for item in range(li, r + 1):
		if item in l:
			l.remove(item)
print(len(l))
if len(l) != 0:
	print(*l)


(leg_count, max_num) = [int(x) for x in input().split()]
legs = []
for _ in range(leg_count):
	(l, r) = [int(x) for x in input().split()]
	legs.append((l, r))
legs = sorted(legs)
new_legs = []
(l_i, r_i) = legs[0]
for (l_c, r_c) in legs[1:]:
	if l_c <= r_i:
		r_i = max(r_c, r_i)
	else:
		new_legs.append((l_i, r_i))
		(l_i, r_i) = (l_c, r_c)
else:
	new_legs.append((l_i, r_i))
new_legs.append((max_num + 1, max_num + 2))
(l, r) = new_legs[0]
leg_id = 0
i = 1
vals = []
while True:
	if i > max_num:
		break
	if i < l:
		vals.append(i)
		i += 1
	elif l <= i <= r:
		i += 1
	else:
		leg_id += 1
		(l, r) = new_legs[leg_id]
print(len(vals))
print(' '.join((str(x) for x in vals)))


[n, m] = [int(x) for x in input().split()]
l = [1] * m
for i in range(n):
	[a, b] = [int(x) for x in input().split()]
	l[a - 1:b] = [0] * (b - a + 1)
print(sum(l))
for i in range(m):
	if l[i] == 0:
		continue
	else:
		print(i + 1, end=' ')


(n, m) = [int(x) for x in input().split(' ')]
plane = [i for i in range(1, m + 1)]
segments = []
for i in range(n):
	(lb, up) = [int(x) for x in input().split(' ')]
	for j in range(lb, up + 1):
		segments.append(j)
ans = list(set(plane) - set(segments))
print(len(ans))
if ans:
	print(*ans, sep=' ')


I = lambda : map(int, input().split())
S = lambda a, b: set(range(a, b + 1))
(n, m) = I()
v = S(1, m)
for _ in ' ' * n:
	v -= S(*I())
print(len(v))
print(*v)


(n, m) = map(int, input().strip().split())
x = [i for i in range(1, m + 1)]
for _ in range(n):
	(l, r) = map(int, input().strip().split())
	for i in range(l, r + 1):
		if i in x:
			x.remove(i)
if len(x) == 0:
	print(0)
else:
	print(len(x))
	print(*x)


(n, m) = list(map(int, input().split(' ')))
inp = range(1, m + 1)
l = []
for i in range(n):
	(a, b) = list(map(int, input().split(' ')))
	l += range(a, b + 1)
res = set(inp) - set(l)
print(len(res))
if len(res) != 0:
	print(*res)


(n, m) = map(int, input().split())
k = 0
o = set(range(1, m + 1))
for i in range(n):
	(l, r) = map(int, input().split())
	for j in range(l, r + 1):
		o.discard(j)
print(len(o))
print(*o)


(m, n) = map(int, input().split())
lst = list(range(1, n + 1))
for i in range(m):
	(l, r) = map(int, input().split())
	for i in range(l, r + 1):
		if i in lst:
			lst.remove(i)
ln = len(lst)
print(ln)
if ln == 0:
	pass
else:
	for i in lst:
		print(i, end=' ')


(n, m) = map(int, input().split())
a = [i for i in range(1, m + 1)]
for i in range(n):
	(l, r) = map(int, input().split())
	for i in range(l, r + 1):
		if i in a:
			a.remove(i)
print(len(a))
for i in a:
	print(i, end=' ')


import collections as cc
import sys
I = lambda : list(map(int, input().split()))
(n, m) = I()
a = []
ar = [0] * (m + 1)
for i in range(n):
	(x, y) = I()
	for j in range(x, y + 1):
		ar[j] = 1
ans = 0
arr = []
for i in range(1, m + 1):
	if ar[i] == 0:
		ans += 1
		arr.append(i)
print(ans)
print(*arr)


def solve(m, segs):
	points = [False for _ in range(m)]
	for seg in segs:
		for p in range(seg[0], seg[1] + 1):
			points[p - 1] = True
	ex_points = list(filter(lambda x: not points[x - 1], range(1, m + 1)))
	ans = [str(len(ex_points)), ' '.join(map(str, ex_points))]
	return '\n'.join(ans)

def main():
	(n, m) = list(map(int, input().split()))
	segs = list()
	for _ in range(n):
		segs.append(list(map(int, input().split())))
	print(solve(m, segs))
main()


(n, m) = map(int, input().split())
a = []
for i in range(0, n):
	(l, r) = map(int, input().split())
	for j in range(l, r + 1):
		a.append(j)
c = 0
for i in range(1, m + 1):
	if i not in a:
		c += 1
print(c)
for i in range(1, m + 1):
	if i not in a:
		print(i, end=' ')


def solve(test):
	ans = []
	(n, m) = map(int, input().split())
	d = [0 for i in range(m + 1)]
	for i in range(n):
		(x, y) = map(int, input().split())
		for j in range(x, y + 1):
			d[j] = 1
	for i in range(1, m + 1):
		if d[i] == 0:
			ans.append(i)
	print(len(ans))
	print(*ans)
t = 1
for _ in range(t):
	solve(_ + 1)


from sys import stdin
from math import *
line = stdin.readline().rstrip().split()
n = int(line[0])
m = int(line[1])
m2 = m
bools = [True] * m
for i in range(n):
	line = stdin.readline().rstrip().split()
	l = int(line[0])
	r = int(line[1])
	for j in range(l - 1, r):
		if bools[j]:
			bools[j] = False
			m2 -= 1
print(m2)
for i in range(m):
	if bools[i]:
		print(i + 1, end=' ')


def rint():
	return int(input())

def rints():
	return list(map(int, input().split()))
(n, m) = rints()
segs = [rints() for _ in range(n)]
p = []
for i in range(1, m + 1):
	if not any((l <= i <= r for (l, r) in segs)):
		p.append(i)
print(len(p))
print(' '.join(map(str, p)))


def print_points(segments, k):
	points = [0] * k
	result = []
	for segment in segments:
		for j in range(segment[0], segment[1] + 1):
			if points[j - 1] == 0:
				points[j - 1] = 1
	for i in range(k):
		if points[i] == 0:
			result.append(i + 1)
	print(len(result))
	if len(result) > 0:
		print(' '.join(map(str, result)))
(n, k) = map(int, input().split())
segments = []
for i in range(n):
	segments.append(list(map(int, input().split())))
print_points(segments, k)


(n, m) = map(int, input().split())
ls = []
fls = [0] * m
for i in range(n):
	ls.append(list(map(int, input().split())))
for i in range(n):
	ind = ls[i][0]
	for j in range(ls[i][1] - ls[i][0] + 1):
		fls[ind - 1] = -1
		ind += 1
print(fls.count(0))
for i in range(m):
	if not fls[i]:
		print(i + 1, end=' ')


(n, m) = map(int, input().split())
points = {x for x in range(1, m + 1)}
for _ in range(n):
	lr = list(map(int, input().split()))
	points.difference_update({x for x in range(lr[0], lr[1] + 1)})
print(len(points))
print(*points)


(n, k) = [int(x) for x in input().split()]
arr = [0] * k
for i in range(n):
	(a, b) = [int(x) for x in input().split()]
	for j in range(a - 1, b):
		arr[j] = 1
print(arr.count(0))
for i in range(k):
	if arr[i] != 1:
		print(i + 1, end=' ')


y = list(map(int, input().split()))
arr = []
for i in range(y[0]):
	z = list(map(int, input().split()))
	for j in range(z[0], z[1] + 1, 1):
		arr.append(j)
rra = []
count = 1
while count <= y[1]:
	if count in arr:
		count += 1
		continue
	else:
		rra.append(count)
		count += 1
print(len(rra))
for i in range(len(rra)):
	if len(rra) - 1 == i:
		print(rra[i], end='')
	else:
		print(rra[i], end=' ')
print()


(n, m) = map(int, input().split())
s = set()
for i in range(n):
	(a, b) = map(int, input().split())
	for j in range(a, b + 1):
		s.add(j)
s = list(s)
print(m - len(s))
for i in range(1, m + 1):
	if i in s:
		b = 1
	else:
		print(i, end=' ')


import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, random, time, queue, copy
sys.setrecursionlimit(10 ** 7)
inf = 10 ** 20
mod = 10 ** 9 + 7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]

def LI():
	return [int(x) for x in sys.stdin.readline().split()]

def LI_():
	return [int(x) - 1 for x in sys.stdin.readline().split()]

def I():
	return int(sys.stdin.readline())

def LS():
	return sys.stdin.readline().split()

def S():
	return input()

def main():
	(n, m) = LI()
	l = [0] * (m + 1)
	for _ in range(n):
		(a, b) = LI()
		l[a - 1] += 1
		l[b] -= 1
	for i in range(m):
		l[i + 1] += l[i]
	print(l[:-1].count(0))
	ans = []
	for (i, x) in enumerate(l[:-1]):
		if x == 0:
			ans.append(i + 1)
	print(' '.join([str(x) for x in ans]))
main()


(n, m) = map(int, input().split())
s = []
for i in range(n):
	(l, r) = map(int, input().split())
	s.append((l, r))
a = [False] * (m + 1)
for (l, r) in s:
	for i in range(l, r + 1):
		a[i] = True
r = []
for i in range(1, m + 1):
	if a[i] == False:
		r.append(i)
print(len(r))
if len(r) > 0:
	s = ''
	for x in r:
		s += str(x) + ' '
	print(s.strip())


(n, m) = map(int, input().split())
l1 = []
for i in range(n):
	(a, b) = map(int, input().split())
	if a == b:
		l1.append(a)
	else:
		for j in range(a, b + 1):
			l1.append(j)
l1 = set(l1)
l3 = {i for i in range(1, m + 1)}
x = l3 - l1
print(len(x))
print(*x)


ent1 = input().split()
num = int(ent1[0])
m = int(ent1[1])
retas = []
out = []
for i in range(0, num):
	par = input().split()
	retas.append((int(par[0]), int(par[1])))
for i in range(1, m + 1):
	fora = True
	for r in retas:
		if i >= r[0] and i <= r[1]:
			fora = False
	if fora:
		out.append(i)
print(str(len(out)))
resposta = ''
for k in out:
	resposta += str(k)
	resposta += ' '
resposta = resposta[:-1]
print(resposta)


(n, m) = map(int, input().split())
f = [0] * (m + 2)
for _ in range(n):
	(u, v) = map(int, input().split())
	f[u] += 1
	f[v + 1] -= 1
for _ in range(1, m + 1):
	f[_] += f[_ - 1]
idx = []
for _ in range(1, m + 1):
	if f[_] == 0:
		idx.append(_)
print(len(idx))
print(*idx)


def send(x):
	print(x)
	return x
(number, bound) = [int(a) for a in input('').split()]
BOUND = [item for item in range(1, bound + 1)]
SEGMENT = []
for i in range(1, number + 1):
	(low, up) = [int(a) for a in input('').split()]
	segment = [x for x in range(low, up + 1)]
	SEGMENT = SEGMENT + segment
SEGMENT = set(SEGMENT)
NOT_INCLUDE = [str(x) for x in BOUND if x not in SEGMENT]
print(len(NOT_INCLUDE))
if len(NOT_INCLUDE) != 0:
	result = ' '.join(NOT_INCLUDE)
	send(result)


from math import sqrt

def main():
	(n, m) = [int(v) for v in input().split()]
	data = []
	for i in range(n):
		(a, b) = [int(v) for v in input().split()]
		data.append((a, b))
	res = []
	for i in range(1, m + 1):
		if not any([a <= i <= b for (a, b) in data]):
			res.append(str(i))
	print(len(res))
	print(' '.join(res))
main()


(n, m) = map(int, input().split())
s = []
ans = []
for i in range(n):
	s.append(list(map(int, input().split())))
for i in range(1, m + 1):
	t = True
	for j in s:
		if i >= j[0] and i <= j[1]:
			t = False
			break
	if t:
		ans.append(i)
print(len(ans))
for i in ans:
	print(i, end=' ')


(n, m) = map(int, input().split(' '))
points = []
pointOfBoundary = []
for i in range(n):
	(l, r) = map(int, input().split(' '))
	for j in range(l, r + 1):
		points.append(j)
for i in range(1, m + 1):
	if i not in points:
		pointOfBoundary.append(i)
length = len(pointOfBoundary)
print(length)
if length != 0:
	if length == 1:
		print(pointOfBoundary[0])
	else:
		for i in range(0, length - 1):
			print(pointOfBoundary[i], end=' ')
		print(pointOfBoundary[-1])


inp = input
li = list
iinp = lambda : int(inp())
ent = lambda : map(int, inp().split())
lient = lambda : [int(i) for i in inp().split()]
li0 = lambda x: [0 for i in range(x)]
stent = lambda : [i for i in inp()]
(n, m) = ent()
segmentos = []
for _ in range(n):
	(l, r) = ent()
	segmentos.append([int(i) for i in range(l, r + 1)])
cont = 0
res = []
for i in range(1, m + 1):
	for j in segmentos:
		if i in j:
			break
	else:
		cont = cont + 1
		res.append(i)
print(cont)
print(*res)


(n, m) = [int(x) for x in input().split()]
s = set()
for i in range(n):
	(x, y) = [int(x) for x in input().split()]
	for j in range(x, y + 1):
		s.add(j)
ans = []
for i in range(1, m + 1):
	if i not in s:
		ans.append(i)
print(len(ans))
print(*ans)


(n, m) = map(int, input().split())
d = {}
endpoints = {}
for i in range(1, m + 1):
	d[i] = 0
	endpoints[i] = False
for i in range(n):
	(a, b) = map(int, input().split())
	try:
		d[a] += 1
	except:
		d[a] = 1
	try:
		d[b] -= 1
	except:
		d[b] = -1
	endpoints[a] = True
	endpoints[b] = True
cnt = 0
for i in range(1, m + 1):
	cnt += d[i]
	d[i] = cnt
res = [i for i in range(1, m + 1) if d[i] == 0 and endpoints[i] == False]
print(len(res))
for i in res:
	print(i, end=' ')
print()


from math import *
from copy import *
from string import *
from random import *
from sys import stdin
from sys import maxsize
from operator import *
from itertools import *
from collections import Counter
import math

def bin1(l, r, k, t, b, val, ans):
	if l > r:
		return ans
	else:
		mid = (l + r) // 2
		v = k ** mid
		if v == val:
			return v
		elif v > val:
			ans = mid
			return bin1(mid + 1, r, k, t, b, val, ans)
		else:
			return bin1(l, mid - 1, k, t, b, val, ans)

def bin2(l, r, k, t, b, val, ans):
	if l > r:
		return ans
	else:
		mid = (l + r) // 2
		v = t * k ** mid + b * mid
		if v == val:
			return v
		elif v > val:
			ans = mid
			return bin2(l, mid - 1, k, t, b, val, ans)
		else:
			return bin2(mid + 1, r, k, t, b, val, ans)

def SieveOfEratosthenes(n):
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	l = []
	for i in range(2, n + 1):
		if prime[i]:
			l.append(i)
	return l

def bin(l, r, ll, val):
	if l > r:
		return -1
	else:
		mid = (l + r) // 2
		if val >= ll[mid][0] and val <= ll[mid][1]:
			return mid
		elif val < ll[mid][0]:
			return bin(l, mid - 1, ll, val)
		else:
			return bin(mid + 1, r, ll, val)

def deci(n):
	s = ''
	while n != 0:
		if n % 2 == 0:
			n = n // 2
			s = '0' + s
		else:
			n = n // 2
			s = '1' + s
	return s

def diff(s1, s2):
	if len(s1) < len(s2):
		v = len(s1)
		while v != len(s2):
			s1 = '0' + s1
			v = v + 1
	else:
		v = len(s2)
		while v != len(s1):
			s2 = '0' + s2
			v = v + 1
	c = 0
	for i in range(len(s1)):
		if s1[i:i + 1] != s2[i:i + 1]:
			c = c + 1
	return c
from sys import stdin, stdout

def fac(a, b):
	v = a
	while a != b:
		v *= a - 1
		a = a - 1
	return v

def bino(l, r, n):
	if l > r:
		return -1
	else:
		mid = (l + r) // 2
		val1 = math.log(n / mid + 1, 2)
		val2 = int(val1)
		if val1 == val2:
			return val1
		elif val1 < 1.0:
			return bino(l, mid - 1, n)
		else:
			return bino(mid + 1, r, n)

def binary(l, r, ll, val, ans):
	if l > r:
		return ans
	else:
		mid = (l + r) // 2
		if ll[mid] == val:
			return ll[mid]
		elif ll[mid] < val:
			ans = ll[mid]
			return binary(mid + 1, r, ll, val, ans)
		else:
			return binary(l, mid - 1, ll, val, ans)

def check(n):
	v = 1
	while n != 0:
		if n % 10 == 0 or n % 10 == 1:
			n = n // 10
		else:
			v = 0
			break
	return v
(m, n) = map(int, input().split(' '))
s = set()
for i in range(m):
	(a, b) = map(int, input().split(' '))
	for j in range(a, b + 1):
		s.add(j)
print(n - len(s))
l = []
for i in range(1, n + 1):
	if i not in s:
		l.append(i)
print(*l)


M = lambda : list(map(int, input().split()))
(n, m) = M()
e = []
a = [0] * (m + 1)
for i in range(n):
	(l, r) = M()
	for j in range(l, r + 1):
		a[j] = 1
for i in range(1, m + 1):
	if a[i]:
		pass
	else:
		e.append(i)
print(len(e))
print(*e)


(n, m) = list(map(int, input().split()))
a = []
ans = 0
ANS = []
for i in range(n):
	a.append(list(map(int, input().split())))
for i in range(1, m + 1):
	for j in a:
		if j[0] <= i <= j[1]:
			break
	else:
		ans += 1
		ANS.append(i)
print(ans)
print(*ANS)


(n, m) = map(int, input().split())
s = list(range(1, m + 1))
for i in range(n):
	(x, y) = map(int, input().split())
	for i in range(x, y + 1):
		if i in s:
			s.remove(i)
print(len(s))
for h in range(len(s)):
	print(s[h], end=' ')


(n, m) = map(int, input().split())
seg = [list(map(int, input().split())) for i in range(n)]
ans = [pt for pt in range(1, m + 1) if all([not s[0] <= pt <= s[1] for s in seg])]
print(len(ans))
print(' '.join([str(pt) for pt in ans]))


(n, m) = map(int, input().split())
s = set(range(1, m + 1))
for i in range(n):
	(l, r) = map(int, input().split())
	s -= set(range(l, r + 1))
print(len(s))
print(*s)


z = input
import math
(n, k) = map(int, input().split())
p = []
for i in range(n):
	(a, b) = map(int, input().split())
	for j in range(a, b + 1):
		if j not in p:
			p.append(j)
p = sorted(p)
np = []
c = 0
for k in range(1, k + 1):
	if k not in p:
		c += 1
		np.append(k)
print(c)
print(*np)


(n, m) = map(int, input().split())
L = [0] * m
for i in range(n):
	(a, b) = map(int, input().split())
	for j in range(a - 1, b):
		L[j] = 1
print(L.count(0))
for i in range(len(L)):
	if L[i] == 0:
		print(i + 1, end=' ')


(n, m) = map(int, input().split())
line = [0] * m
for _ in range(n):
	(a, b) = map(int, input().split())
	a -= 1
	b -= 1
	line[a] += 1
	if b < m - 1:
		line[b + 1] -= 1
zeros = []
if line[0] == 0:
	zeros.append(1)
for i in range(1, m):
	line[i] += line[i - 1]
	if line[i] == 0:
		zeros.append(i + 1)
print(len(zeros))
for ele in zeros:
	print(ele, end=' ')


(n, m) = map(int, input().split())
prefix = [0] * 102
ans = [0] * 102
cnt = 0
for i in range(1, n + 1):
	(l, r) = map(int, input().split())
	prefix[l] += 1
	prefix[r + 1] -= 1
for i in range(2, m + 1):
	prefix[i] += prefix[i - 1]
for i in range(1, m + 1):
	if prefix[i] == 0:
		ans[cnt] = i
		cnt += 1
print(cnt)
if cnt == 0:
	print('')
else:
	for i in range(0, cnt):
		print(ans[i], end=' ')


(n, m) = map(int, input().split())
a = set()
for i in range(n):
	(li, ri) = map(int, input().split())
	for j in range(li, ri + 1):
		a.add(j)
print(m - len(a))
for i in range(1, m + 1):
	if i not in a:
		print(i, end=' ')


(n, m) = map(int, input().split())
d = dict()
for j in range(n):
	b = list(map(int, input().split()))
	x = b[0]
	y = b[1]
	i = x
	while i <= y:
		d[i] = 1
		i += 1
p = 0
a = []
for j in range(1, m + 1):
	if j in d.keys():
		pass
	else:
		p += 1
		a.append(j)
print(p)
print(*a)


(n, m) = map(int, input().split())
segments = [list(map(int, input().split())) for _ in range(n)]

def is_contained(p):
	for segment in segments:
		if segment[0] <= p <= segment[1]:
			return True
	return False
notCovered = []
for i in range(1, m + 1):
	if not is_contained(i):
		notCovered.append(str(i))
print(len(notCovered))
print(' '.join(notCovered))


import sys, math
(n, m) = map(int, input().split())
a = []
for i in range(n):
	a.append(tuple(map(int, input().split())))
ob = [True] * m
for (x, y) in a:
	for i in range(x - 1, y):
		ob[i] = False
print(sum(ob))
print(' '.join((str(i + 1) for i in range(m) if ob[i])))


(a, b) = map(int, input().split())
points = [0] * b
for i in range(a):
	(m, n) = map(int, input().split())
	for j in range(m - 1, n):
		points[j] = 1
output = []
for i in range(b):
	if points[i] == 0:
		output.append(i + 1)
print(len(output))
print(' '.join(map(str, output)))


(n, m) = [int(x) for x in input().split()]
m = set(range(1, m + 1))
for i in range(n):
	(l, r) = [int(x) for x in input().split()]
	m = m - set(range(l, r + 1))
print(len(m))
for i in m:
	print(i, end=' ')


(n, m) = [int(i) for i in input().split()]
f = [True] * (m + 1)
f[0] = False
for i in range(n):
	(p, q) = [int(j) for j in input().split()]
	for j in range(p, q + 1):
		f[j] = False
print(sum(f))
for i in range(1, m + 1):
	if f[i]:
		print(i, end=' ')
print()


(n, m) = map(int, input().split())
d = [0 for i in range(m + 1)]
k = 0
for i in range(n):
	(a, b) = map(int, input().split())
	for j in range(a, b + 1):
		if d[j] == 0:
			d[j] = 1
			k += 1
print(m - k)
for j in range(1, m + 1):
	if d[j] == 0:
		print(j, end=' ')


(n, m) = map(int, input().split())
a = [0] * (m + 2)
for i in range(n):
	(l, r) = map(int, input().split())
	a[l] -= 1
	a[r + 1] += 1
for i in range(1, m + 2):
	a[i] += a[i - 1]
b = []
for i in range(1, m + 1):
	if a[i] >= 0:
		b.append(i)
print(len(b))
for i in range(len(b)):
	print(b[i], end=' ')


(a, b) = map(int, input().split())
v = []
for i in range(1, b + 1):
	v.append(i)
for i in range(a):
	(c, d) = map(int, input().split())
	for i in range(c, d + 1):
		if i in v:
			v.remove(i)
print(len(v))
for i in v:
	print(i, end=' ')


(n, k) = map(int, input().split())
a = [i for i in range(1, k + 1)]
for i in range(n):
	(r, l) = map(int, input().split())
	for j in range(r, l + 1):
		if j in a:
			del a[a.index(j)]
print(len(a))
print(' '.join(map(str, a)))


(n, m) = map(int, input().split())
map1 = {}
for _ in range(n):
	(x, y) = map(int, input().split())
	for i in range(x, y + 1):
		if i not in map1.keys():
			map1[i] = 1
z = map1.keys()
list1 = []
for i in range(1, m + 1):
	if i not in z:
		list1.append(i)
if len(list1) == 0:
	print(0)
else:
	print(len(list1))
	print(*list1, sep=' ')


(m, n) = map(int, input().split())
x = []
for i in range(m):
	(x1, y1) = [int(i) for i in input().split()]
	x.append([x1, y1])
b = set()
for i in range(m):
	c = x[i][0]
	d = x[i][1]
	for j in range(c, d + 1):
		b.add(j)
ans = [str(i + 1) for i in range(n)]
for i in b:
	ans.remove(str(i))
print(len(ans))
print(' '.join(ans))


(n, m) = map(int, input().split())
nums = [int(i) for i in range(1, m + 1)]
for i in range(n):
	(l, r) = map(int, input().split())
	for i in range(l, r + 1):
		try:
			nums.remove(i)
		except:
			pass
print(len(nums))
for i in nums:
	print(i, end=' ')


(n, m) = tuple(map(int, input().split()))
points = [0 for _ in range(m + 1)]
isEnd = [0 for _ in range(m + 1)]
for i in range(n):
	(l, r) = tuple(map(int, input().split()))
	points[l] += 1
	points[r] -= 1
	isEnd[l] = isEnd[r] = True
(cur, res) = (0, [])
for i in range(1, m + 1):
	if cur == 0 and points[i] == 0 and (not isEnd[i]):
		res.append(str(i))
	cur += points[i]
print(len(res))
print(' '.join(res))


n_m = input()
decomp = n_m.split(' ')
n = int(decomp[0])
m = int(decomp[1])
c = n
res = ''
otrezok_max = list(range(1, m + 1))
otrezki = []
tochki1 = []
tochki = []
while n != 0:
	otrezok = input()
	decomp = otrezok.split(' ')
	otrezki.append(decomp)
	n -= 1
for i in range(0, c):
	a = int(otrezki[i][0])
	b = int(otrezki[i][1])
	num = list(range(a, b + 1))
	tochki1.append(num)
for i in range(0, len(tochki1)):
	for j in range(0, len(tochki1[i])):
		tochki.append(tochki1[i][j])
tochki = set(tochki)
tochki = list(tochki)
for i in range(0, len(tochki)):
	otrezok_max.remove(tochki[i])
for i in range(0, len(otrezok_max)):
	q = otrezok_max[i]
	res += str(q) + ' '
print(len(otrezok_max))
print(res)


(n, m) = map(int, input().split())
s = [0] * (m + 1)
for _ in range(n):
	(l, r) = map(int, input().split())
	for i in range(l, r + 1):
		s[i] = 1
cnt = 0
re = list()
for i in range(1, m + 1):
	if s[i] == 0:
		cnt += 1
		re.append(i)
if cnt:
	print(cnt)
	print(*re)
else:
	print(0)


def OutOfSegments(s, ub):
	res = []
	for i in range(1, ub + 1):
		if i not in s:
			res.append(i)
	return res
(m, n) = map(int, input().split())
s = []
for i in range(m):
	(l, u) = map(int, input().split())
	for j in range(l, u + 1):
		s.append(j)
res = OutOfSegments(s, n)
print(len(res))
print(' '.join(map(str, res)))


(n, m) = map(int, input().split())
imos = [0] * (m + 2)
for i in range(n):
	(l, r) = map(int, input().split())
	imos[l] += 1
	imos[r + 1] -= 1
from itertools import accumulate
imos = list(accumulate(imos))
ans = []
for i in range(1, m + 1):
	if imos[i] == 0:
		ans.append(i)
print(len(ans))
print(*ans)


(n, m) = list(map(int, input().split()))
a = [0] * n
for i in range(n):
	a[i] = list(map(int, input().split()))
ans = []
for i in range(1, m + 1):
	boo = 0
	for j in a:
		if j[0] <= i and j[1] >= i:
			boo = 1
	if not boo:
		ans.append(i)
print(len(ans))
print(*ans)


(n, m) = map(int, input().split())
fs = set()
for i in range(1, m + 1):
	fs.add(i)
for i in range(n):
	(a, b) = map(int, input().split())
	hmmm = set()
	for i in range(a, b + 1):
		hmmm.add(i)
	fs -= hmmm
print(len(fs))
print(*fs)


import sys
from collections import deque
mod = 10 ** 9 + 7
INF = float('inf')

def inp():
	return int(sys.stdin.readline())

def inpl():
	return list(map(int, sys.stdin.readline().split()))
(n, m) = inpl()
res = [False] * (m + 1)
for _ in range(n):
	(l, r) = inpl()
	for i in range(l, r + 1):
		res[i] = True
ans = []
for i in range(1, m + 1):
	if not res[i]:
		ans.append(i)
print(len(ans))
print(*ans)


(m, n) = map(int, input().split())
ss = set(range(1, n + 1))
for i in range(m):
	(a, b) = map(int, input().split())
	for j in range(a, b + 1):
		ss.discard(j)
print(len(ss))
print(*ss)


(n, m) = map(int, input().split())
s = set()
l1 = []
for i in range(n):
	(a, b) = map(int, input().split())
	for j in range(a, b + 1):
		s.add(j)
for i in range(1, m + 1):
	if i not in s:
		l1.append(i)
print(len(l1))
print(*l1)


inpt = input()
(num, upper_limit) = inpt.split(' ')
(num, upper_limit) = (int(num), int(upper_limit))
rng = list(range(1, upper_limit + 1))
rngset = set(rng)
lines = []
for i in range(num):
	l = input()
	(l1, l2) = l.split(' ')
	(l1, l2) = (int(l1), int(l2))
	lrngset = set(list(range(l1, l2 + 1)))
	rngset = rngset - lrngset
print(len(rngset))
print(*rngset)


import math
from decimal import Decimal
import heapq

def na():
	n = int(input())
	b = [int(x) for x in input().split()]
	return (n, b)

def nab():
	n = int(input())
	b = [int(x) for x in input().split()]
	c = [int(x) for x in input().split()]
	return (n, b, c)

def dv():
	(n, m) = map(int, input().split())
	return (n, m)

def dva():
	(n, m) = map(int, input().split())
	a = [int(x) for x in input().split()]
	b = [int(x) for x in input().split()]
	return (n, m, b)

def eratosthenes(n):
	sieve = list(range(n + 1))
	for i in sieve:
		if i > 1:
			for j in range(i + i, len(sieve), i):
				sieve[j] = 0
	return sorted(set(sieve))

def nm():
	n = int(input())
	b = [int(x) for x in input().split()]
	m = int(input())
	c = [int(x) for x in input().split()]
	return (n, b, m, c)

def dvs():
	n = int(input())
	m = int(input())
	return (n, m)
(n, m) = map(int, input().split())
a = [0] * m
for i in range(n):
	(l, r) = map(int, input().split())
	for i in range(l - 1, r):
		a[i] = 1
print(a.count(0))
for i in range(m):
	if a[i] == 0:
		print(i + 1, end=' ')


(n, m) = map(int, input().split())
b = []
for i in range(n):
	b.append(list(map(int, input().split())))
a = []
for i in range(1, m + 1):
	a.append(i)
for i in range(n):
	for j in range(b[i][0], b[i][1] + 1):
		if j in a:
			a.remove(j)
print(len(a))
if len(a) > 0:
	for i in a:
		print(i, end=' ')


R = lambda : map(int, input().split())
(n, m) = R()
a = [0] * (m + 1)
for _ in [0] * n:
	(l, r) = R()
	a[l - 1] += 1
	a[r] -= 1
s = 0
b = []
for i in range(m):
	s += a[i]
	if s == 0:
		b += [i + 1]
print(len(b))
print(*b)


[n, m] = [int(i) for i in input().split()]
arr = [0] * m
for i in range(n):
	[s, e] = [int(i) for i in input().split()]
	for i in range(s, e + 1):
		arr[i - 1] = 1
out = []
for i in range(m):
	if arr[i] == 0:
		out.append(i + 1)
print(len(out))
for i in out:
	print(i, end=' ')
print()


(n, m) = input().split()
(n, m) = (int(n), int(m))
t = []
for i in range(1, m + 1):
	t += [i]
for i in range(n):
	(l, r) = input().split()
	(l, r) = (int(l), int(r))
	for j in range(l, r + 1):
		if j in t:
			t.remove(j)
print(len(t))
for j in range(len(t)):
	print(t[j], end=' ')


(n, m) = map(int, input().split())
a = []
for i in range(m):
	a.append(0)
for i in range(n):
	(l, r) = map(int, input().split())
	for i in range(l - 1, r):
		a[i] += 1
p = a.count(0)
if p > 0:
	print(p)
	for i in range(m):
		if a[i] == 0:
			print(i + 1, end=' ')
else:
	print(0)


(n, m) = map(int, input().split())
isFree = [True] * m
for _ in range(n):
	(l, r) = map(int, input().split())
	for i in range(l, r + 1):
		isFree[i - 1] = False
print(isFree.count(True))
for i in range(m):
	if isFree[i]:
		print(i + 1, end=' ')


from bisect import bisect_right as br
import sys
from collections import *
from math import *
import re

def sieve(n):
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	c = 0
	for i in range(2, n):
		if prime[i]:
			c += 1
	return c

def iseven(n):
	return [False, True][0 if n % 2 else 1]

def inp_arr():
	return list(map(int, input().split()))

def inp():
	return map(int, input().split())

def lcm(a, b):
	return a * b / gcd(a, b)
max_int = sys.maxsize
mod = 10 ** 9 + 7
(n, m) = inp()
arr = [0] * (m + 1)
(ans, c) = ([], 0)
while n:
	(a, b) = inp()
	for i in range(a, b + 1):
		arr[i] += 1
	n -= 1
for i in range(1, len(arr)):
	if arr[i] == 0:
		c += 1
		ans.append(i)
print(c)
print(*ans)


(n, m) = map(int, input().split())
dp = [0 for i in range(m + 1)]
for n0 in range(n):
	(l, r) = map(int, input().split())
	for i in range(l, r + 1):
		dp[i] = 1
res = []
for i in range(1, m + 1):
	if dp[i] == 0:
		res.append(i)
print(len(res))
for e in res:
	print(e, end=' ')
print()


(n, m) = map(int, input().split())
l = list(range(1, m + 1))
a = set(l[:])
b = set()
for i in range(n):
	(i, j) = map(int, input().split())
	b = b | set(l[i - 1:j])
print(len(a - b))
print(' '.join((str(i) for i in a - b)))


(n, m) = [*map(int, input().split())]
s = set()
for _ in range(n):
	(l, r) = [*map(int, input().split())]
	s.update(range(l, r + 1))
ans = set(range(1, m + 1)) - s
print(len(ans))
print(*ans, sep=' ')


(n, m) = input().split(' ')[:2]
n = int(n)
m = int(m)
points = set()
for _ in range(n):
	(l, r) = input().split(' ')[:2]
	l = int(l)
	r = int(r)
	for k in range(l, r + 1):
		points.add(k)
x = [str(i) for i in range(1, m + 1) if i not in points]
print(len(x))
if len(x):
	print(' '.join(x))


(n, m) = map(int, input().split())
s = []
c = []
d = []
for i in range(m):
	s.append(i + 1)
for i in range(n):
	(f, b) = map(int, input().split())
	for j in range(f, b + 1):
		if j not in c:
			c.append(j)
c.sort()
for i in range(len(s)):
	if not s[i] in c:
		d.append(s[i])
print(len(d))
print(*d)


(n, m) = map(int, input().split(' '))
l = []
r = []
lis = []
lis2 = []
for j in range(m):
	lis.append(j + 1)
	lis = list(map(int, lis))
for i in range(n):
	(n1, n2) = map(int, input().split(' '))
	l.append(n1)
	r.append(n2)
for j in range(m):
	for k in range(n):
		if lis[j] == l[k] or lis[j] == r[k]:
			lis2.append(lis[j])
		elif lis[j] > l[k] and lis[j] < r[k]:
			lis2.append(lis[j])
diff = list(set(lis).difference(set(lis2)))
if len(diff) > 0:
	print(len(diff))
	print(*diff)
else:
	print(0)


(n, m) = map(int, input().split())
a = list(range(1, m + 1))
b = [0 for i in range(m)]
for i in range(n):
	(l, r) = map(int, input().split())
	for i in range(l - 1, r):
		b[i] = 1
print(b.count(0))
for i in range(m):
	if not b[i]:
		print(i + 1, end=' ')
print()


(n, m) = map(int, input().split())
p = [0 for i in range(m)]
for _ in range(n):
	(u, v) = map(int, input().split())
	for j in range(u, v + 1):
		p[j - 1] += 1
ans = 0
x = []
for i in range(m):
	if p[i] == 0:
		ans += 1
		x.append(i + 1)
print(ans)
print(*x)


(n, m) = map(int, input().split(' '))
D = {}
k = 0
M = {}
while n > 0:
	n -= 1
	(l, r) = map(int, input().split(' '))
	for i in range(l, r + 1):
		D[i] = 1
for i in range(1, m + 1):
	if i not in D:
		M[i] = 1
print(len(M))
for key in M.keys():
	print(key, end=' ')


l = list(map(int, input().split()))
x = []
for i in range(1, l[1] + 1):
	x.append(i)
l2 = []
for i in range(0, l[0]):
	l1 = []
	l1 = list(map(int, input().split()))
	for j in range(l1[0], l1[1] + 1):
		l2.append(j)
l3 = []
l3 = list(set(l2))
print(l[1] - len(l3))
l2 = []
l2 = list(set(x) - set(l3))
for i in range(0, len(l2)):
	print(l2[i], end=' ')


(n, h) = map(int, input().split())
c = []
v = []
for i in range(n):
	(a, b) = map(int, input().split())
	for w in range(a, b + 1):
		if w not in c:
			c.append(w)
for i in range(1, h + 1):
	v.append(i)
print(len(v) - len(c))
for i in range(len(v)):
	if v[i] not in c:
		print(v[i], end=' ')


(n, m) = map(int, input().split())
u = [0] * m
for i in range(n):
	(l, r) = map(int, input().split())
	for i in range(l - 1, r):
		u[i] = 1
ans = []
for i in range(m):
	if not u[i]:
		ans.append(i + 1)
print(len(ans))
for i in ans:
	print(i, end=' ')


(n, m) = [int(x) for x in input().split(' ')]
nx = []
nf = []
for i in range(n):
	(l, r) = [int(x) for x in input().split(' ')]
	nx.append((l, r))
for i in range(1, m + 1):
	flag = False
	for nv in nx:
		if i >= nv[0] and i <= nv[1]:
			flag = True
	if not flag:
		nf.append(i)
print(len(nf))
print(' '.join([str(x) for x in nf]))


l = []
a = list(map(int, input().split()))
for i in range(1, a[1] + 1):
	l.append(i)
for i in range(a[0]):
	b = list(map(int, input().split()))
	if b[0] == b[1]:
		if b[0] in l:
			l.remove(b[0])
	else:
		for j in range(b[0], b[1] + 1):
			if j in l:
				l.remove(j)
print(len(l))
print(*l)


(n, m) = map(int, input().split())
coordinates = []
for i in range(m):
	coordinates.append(i + 1)
for i in range(n):
	(l, r) = map(int, input().split())
	for j in range(l, r + 1):
		if j in coordinates:
			coordinates.remove(j)
print(len(coordinates))
print(*coordinates)


(n, m) = map(int, input().split())
a = []
kol = 0
toch = []
for i in range(n):
	a.append(list(map(int, input().split())))
a.sort()
for j in range(1, m + 1):
	c = 0
	c1 = 0
	for k in a:
		if k[0] <= j and j <= k[1]:
			c = 1
			if j in toch:
				toch.remove(j)
				kol -= 1
			continue
		elif c != 1 and c1 != 1:
			kol += 1
			toch.append(j)
			c1 = 1
print(kol)
print(*toch)


x = [int(i) for i in input().split()]
array = [0] * x[1]
for i in range(x[0]):
	y = [int(j) for j in input().split()]
	for j in range(y[0] - 1, y[1]):
		array[j] += 1
jlh = 0
hasil = []
for i in range(len(array)):
	if array[i] == 0:
		jlh += 1
		hasil += [i + 1]
print(jlh)
for i in hasil:
	print(i, end=' ')


(n, m) = map(int, input().split())
a = list()
for j in range(n):
	(L, R) = map(int, input().split())
	a.append((L, R))
b = list()
for i in range(1, m + 1):
	OK = True
	for j in range(n):
		if a[j][0] <= i <= a[j][1]:
			OK = False
	if OK:
		b.append(i)
print(len(b))
print(*b)


(n, m) = map(int, input().split())
A = []
for o in range(m):
	A.append(o + 1)
for t in range(n):
	(l, r) = map(int, input().split())
	for p in range(l, r + 1):
		if p in A:
			A.remove(p)
print(len(A))
print(*A)


from sys import stdin, stdout

def main():
	(n, m) = map(int, stdin.readline().split())
	A = [True for _ in range(m)]
	for _ in range(n):
		(a, b) = map(int, stdin.readline().split())
		for i in range(a - 1, b):
			A[i] = False
	R = []
	for i in range(m):
		if A[i]:
			R.append(i + 1)
	stdout.write('{}\n'.format(len(R)))
	stdout.write(' '.join(map(str, R)))
main()


(n, m) = map(int, input().split())
x = [0] * m
for i in range(n):
	(l, r) = [int(i) - 1 for i in input().split()]
	for i in range(l, r + 1):
		x[i] = 1
x = [str(i + 1) for i in range(m) if x[i] == 0]
print(len(x))
print(' '.join(x))


import collections, atexit, math, sys
from functools import cmp_to_key
sys.setrecursionlimit(1000000)

def getIntList():
	return list(map(int, input().split()))
import bisect
try:
	import numpy

	def dprint(*args, **kwargs):
		print(*args, **kwargs, file=sys.stderr)
	dprint('debug mode')
except ModuleNotFoundError:

	def dprint(*args, **kwargs):
		pass

def memo(func):
	cache = {}

	def wrap(*args):
		if args not in cache:
			cache[args] = func(*args)
		return cache[args]
	return wrap

@memo
def comb(n, k):
	if k == 0:
		return 1
	if n == k:
		return 1
	return comb(n - 1, k - 1) + comb(n - 1, k)
inId = 0
outId = 0
if inId > 0:
	dprint('use input', inId)
	sys.stdin = open('input' + str(inId) + '.txt', 'r')
if outId > 0:
	dprint('use output', outId)
	sys.stdout = open('stdout' + str(outId) + '.txt', 'w')
	atexit.register(lambda : sys.stdout.close())
(N, M) = getIntList()
zz = set()
for i in range(N):
	(l, r) = getIntList()
	for j in range(l, r + 1):
		zz.add(j)
print(M - len(zz))
for i in range(1, M + 1):
	if i not in zz:
		print(i, end=' ')


(n, m) = map(int, input().split())
u = []
for i in range(1, m + 1):
	u.append(i)
l = []
for i in range(n):
	(x, y) = map(int, input().split())
	for i in range(x, y + 1):
		l.append(i)
t = []
for i in u:
	if i not in l:
		t.append(i)
print(len(t))
for i in t:
	print(i, end=' ')


import sys
(n, m) = (int(s) for s in input().split())
segments = []
for i in range(n):
	(left, right) = (int(s) for s in input().split())
	segments.append((left, right))
sol = []
for i in range(1, m + 1):
	ok = True
	for j in range(n):
		(l, r) = segments[j]
		if l <= i <= r:
			ok = False
			break
	if ok:
		sol.append(i)
sys.stdout.write(str(len(sol)) + '\n')
for i in sol:
	sys.stdout.write(str(i) + ' ')
sys.stdout.write('\n')


import sys

def get_ints():
	return map(int, sys.stdin.readline().strip().split())

def get_array():
	return list(map(int, sys.stdin.readline().strip().split()))

def input():
	return sys.stdin.readline().strip()
(n, m) = get_ints()
llist = []
rlist = []
for i in range(0, n):
	(l, r) = get_ints()
	llist.append(l)
	rlist.append(r)
val = [i for i in range(1, m + 1)]
c = 0
ans = []
for i in val:
	f = 0
	for j in range(0, n):
		if i >= llist[j] and i <= rlist[j]:
			break
		else:
			f = f + 1
	if f == n:
		c = c + 1
		ans.append(i)
if c > 0:
	print(c)
	print(*ans)
else:
	print(0)


from sys import maxsize, stdout, stdin, stderr
mod = int(1000000000.0 + 7)
import sys

def I():
	return int(stdin.readline())

def lint():
	return [int(x) for x in stdin.readline().split()]

def S():
	return input().strip()

def grid(r, c):
	return [lint() for i in range(r)]
from collections import defaultdict, Counter
import math
import heapq
from heapq import heappop, heappush
import bisect
from itertools import groupby

def gcd(a, b):
	while b:
		a %= b
		tmp = a
		a = b
		b = tmp
	return a

def lcm(a, b):
	return a / gcd(a, b) * b

def check_prime(n):
	for i in range(2, int(n ** (1 / 2)) + 1):
		if not n % i:
			return False
	return True

def Bs(a, x):
	i = 0
	j = 0
	left = 0
	right = len(a)
	flag = False
	while left < right:
		mi = (left + right) // 2
		if a[mi] <= x:
			left = mi + 1
			i += 1
		else:
			right = mi
			j += 1
	if left > 0 and a[left - 1] == x:
		return (i - 1, j)
	else:
		return (-1, -1)

def nCr(n, r):
	return fact(n) // (fact(r) * fact(n - r))

def fact(n):
	res = 1
	for i in range(2, n + 1):
		res = res * i
	return res

def primefactors(n):
	num = 0
	while n % 2 == 0:
		num += 1
		n = n / 2
	for i in range(3, int(math.sqrt(n)) + 1, 2):
		while n % i == 0:
			num += 1
			n = n // i
	if n > 2:
		num += 1
	return num

def ask(a):
	print('? {}'.format(a), flush=True)
	n = lint()
	return n

def dfs(i, p):
	(a, tmp) = (0, 0)
	for j in d[i]:
		if j != p:
			a += 1
			tmp += dfs(j, i)
	if a == 0:
		return 0
	return tmp / a + 1
(n, m) = lint()
li = []
s = [0] * (m + 1)
for _ in range(n):
	(l, r) = lint()
	for i in range(l, r + 1):
		s[i] += 1
d = Counter(s)
for i in range(1, m + 1):
	if s[i] == 0:
		li.append(i)
print(len(li))
print(*li)


st = [int(i) for i in input().split(' ')]
n = st[0]
m = st[1]
a = [0] * m
f = []
k = 0
for i in range(n):
	c = [int(t) for t in input().split(' ')]
	c1 = c[0]
	c2 = c[1]
	for j in range(c1 - 1, c2):
		a[j] += 1
for i in range(len(a)):
	if a[i] == 0:
		k = k + 1
		f.append(i + 1)
print(k)
for i in range(k):
	print(f[i], sep=' ', end=' ')


import sys

def main():
	inp = sys.stdin.read().strip().split('\n')
	m = set(range(1, int(inp[0].split()[1]) + 1))
	for s in inp[1:]:
		(l, r) = map(int, s.split())
		m -= set(range(l, r + 1))
	return (len(m), ' '.join(map(str, m)))
print(*main(), sep='\n')


(n, m) = map(int, input().split())
a = [0] * m
for i in range(n):
	(l, r) = map(int, input().split())
	for i in range(l - 1, r):
		a[i] = 1
if all(a):
	print(0)
else:
	print(m - sum(a))
	for (i, x) in enumerate(a, 1):
		if x == 0:
			print(i, end=' ')


(n, m) = map(int, input().split())
segments = []
for _ in range(n):
	(l_i, r_i) = map(int, input().split())
	segments.append((l_i, r_i))
remains = []
for x in range(1, m + 1):
	not_in = True
	for segment in segments:
		(l_i, r_i) = tuple(segment)
		if x >= l_i and x <= r_i:
			not_in = False
			break
	if not_in:
		remains.append(x)
print(len(remains))
for x in remains:
	print(x, end=' ')


(n, m) = map(int, input().split())
otr = []
for i in range(n):
	otr.append([int(j) for j in input().split()])
answer = 0
s = []
for i in range(1, m + 1):
	Ok = True
	for j in range(n):
		if otr[j][0] <= i and otr[j][1] >= i:
			Ok = False
	if Ok:
		s.append(i)
		answer += 1
print(answer)
print(' '.join(map(str, s)))


(n, m) = map(int, input().split())
res = set([int(i) for i in range(1, m + 1)])
temp = set()
for i in range(n):
	(a, b) = map(int, input().split())
	temp = temp.union(set([int(i) for i in range(a, b + 1)]))
res = res.difference(temp)
print(len(res))
print(*res)


(n, m) = [int(x) for x in input().strip().split()]
count = [0 for _ in range(1, m + 2)]
segments = [[int(x) for x in input().strip().split()] for _ in range(n)]
for s in segments:
	for i in range(s[0], s[1] + 1):
		count[i] = 1
no = []
l = 0
for i in range(1, m + 1):
	if count[i] == 0:
		no.append(str(i))
		l += 1
print(l)
print(' '.join(no))


a = input().strip().split(' ')
n = int(a[0])
m = int(a[1])
pairs = []
for i in range(n):
	z = input().strip().split(' ')
	z = [int(i) for i in z]
	pairs.append(z)
result = []
k = 0
for j in range(1, m + 1):
	out = 0
	for x in pairs:
		if (j > x[0] or j == x[0]) and (j < x[1] or j == x[1]):
			out = 1
	if out == 0:
		k = k + 1
		result.append(j)
print(k)
for i in result:
	print(i, end=' ')


(n, m) = map(int, input().split())
s = []
for i in range(n):
	s.append(list(map(int, input().split())))
j = []
for i in range(1, m + 1):
	for k in s:
		if i <= k[1] and i >= k[0]:
			break
	else:
		j.append(i)
print(len(j))
print(*j)


(n, m) = map(int, input().split())
a = list(range(1, m + 1))
for z in range(n):
	(s, l) = map(int, input().split())
	for i in range(s, l + 1):
		if i in a:
			a.remove(i)
print(len(a))
print(*a)


(n, k) = list(map(int, input().split()))
t = []
for i in range(1, k + 1):
	t.append(str(i))
for j in range(n):
	(l, u) = list(map(int, input().split()))
	for k in range(l, u + 1):
		if str(k) in t:
			t[t.index(str(k))] += '*'
o = []
for v in t:
	if '*' not in v:
		o.append(v)
print(len(o))
for q in o:
	print(q, end=' ')


num = input()
status = num.split(' ')
ls = [0] * (eval(status[1]) + 1)
for i in range(eval(status[0])):
	arr = input().split(' ')
	for j in range(eval(arr[0]), eval(arr[1]) + 1):
		ls[j] = 1
ans = 0
lt = []
for i in range(1, len(ls)):
	if ls[i] == 0:
		ans += 1
		lt.append(str(i))
print(ans)
if len(lt) != 0:
	print(' '.join(lt))


(n, m) = list(map(int, input().split()))
points = list(range(1, m + 1))
for i in range(n):
	(a, b) = list(map(int, input().split()))
	for j in range(a, b + 1):
		try:
			points.remove(j)
		except:
			pass
print(len(points))
print(' '.join(map(str, points)))


(n, m) = map(int, input().split())
c = m * [0]
num = 0
res = []
for i in range(n):
	(l, r) = map(int, input().split())
	for j in range(l, r + 1):
		c[j - 1] = 1
for i in range(len(c)):
	if c[i] == 0:
		res.append(i + 1)
print(len(res))
print(' '.join(map(str, res)))


def xisn(a, b):
	c = 0
	c = a.count(b)
	if c > 0:
		return True
	else:
		return False
a = list(map(int, input().split()))
b = [i for i in range(0, a[0])]
for j in range(0, a[0]):
	b[j] = list(map(int, input().split()))
c = [i + 1 for i in range(0, a[1])]
for k in range(0, a[0]):
	i = 0
	for o in range(b[k][0], b[k][1] + 1):
		m = b[k][0] + i
		if xisn(c, m):
			c.remove(b[k][0] + i)
		i = i + 1
h = len(c)
print(h)
for k in range(0, h):
	print(c[k], end=' ')


(n, m) = [int(s) for s in input().split(' ')]
current = [i for i in range(1, m + 1)]
for segment in range(n):
	(l, r) = [int(s) for s in input().split(' ')]
	for j in range(l, r + 1):
		if j in current:
			current.remove(j)
print(len(current))
print(' '.join([str(x) for x in current]))


import math
from collections import *
import sys
from functools import reduce

def get_ints():
	return map(int, input().strip().split())

def get_list():
	return list(get_ints())

def get_string():
	return list(input().strip().split())

def printxsp(*args):
	return print(*args, end='')

def printsp(*args):
	return print(*args, end=' ')
UGLYMOD = int(1000000000.0) + 7
SEXYMOD = 998244353
MAXN = int(100000.0)
(n, m) = get_ints()
line = [0] * (m + 2)
for i in range(n):
	(a, b) = get_ints()
	line[a] += 1
	line[b + 1] -= 1
for i in range(1, m + 2):
	line[i] += line[i - 1]
ans = [i for i in range(1, m + 1) if not line[i]]
print(len(ans))
print(*ans)


(a, b) = map(int, input().split())
z = list()
l = list()
r = list()
for i in range(1, b + 1):
	z.append(i)
for i in range(a):
	(m, n) = map(int, input().split())
	for j in range(m, n + 1):
		r.append(j)
	for k in range(len(z)):
		if z[k] in r:
			l.append(z[k])
for i in range(len(l)):
	if l[i] in z:
		z.remove(l[i])
x = str()
print(len(z))
for i in range(len(z)):
	x += str(z[i]) + ' '
print(x)


(n, m) = map(int, input().split())
alist = [i for i in range(0, m + 1)]
anewlist = []
count = 0
nonlist = []
for i in range(0, n):
	(x, y) = map(int, input().split())
	anewlist.extend(alist[x:y + 1])
aset = set(anewlist)
for i in range(1, m + 1):
	if i not in aset:
		count = count + 1
		nonlist.append(i)
print(count)
for i in nonlist:
	print(i, end=' ')


(n, m) = map(int, input().split())
p = []
q = []
for i in range(n):
	(l, r) = map(int, input().split())
	for j in range(l, r + 1):
		p.append(j)
for i in range(1, m + 1):
	if i not in p:
		q.append(i)
print(len(q))
for i in q:
	print(str(i), end=' ')


(n, m) = [int(x) for x in input().split()]
lst = [1] * m
for _ in range(n):
	(l, r) = [int(x) for x in input().split()]
	lst[l - 1:r] = [0] * (r - l + 1)
print(lst.count(1))
for i in range(m):
	if lst[i] == 1:
		print(i + 1, end=' ')


(n, m) = map(int, input().split())
l = []
for _ in range(n):
	(a, b) = map(int, input().split())
	l.append((a, b))
ans = []
for _ in range(1, m + 1):
	flag = 1
	for i in l:
		if _ >= i[0] and _ <= i[1]:
			flag = 0
			break
	if flag == 1:
		ans.append(_)
print(len(ans))
for i in ans:
	print(i, end=' ')


(n, m) = map(int, input().split())
i = 0
starts = []
ends = []
segs = []
while i < n:
	(l, r) = map(int, input().split())
	starts.append(l)
	ends.append(r)
	segs.append([l, r])
	i += 1
segs.sort(key=lambda seg: seg[0])
ans_points = []
j = 0
i = 1
while i <= m:
	if j >= len(segs):
		ans_points.append(i)
		i += 1
		continue
	if i >= segs[j][0] and i <= segs[j][1]:
		i += 1
		continue
	if i < segs[j][0]:
		ans_points.append(i)
		i += 1
		continue
	if i > segs[j][1]:
		j += 1
		continue
print(ans_points.__len__())
for pt in ans_points:
	print(pt, end=' ')
print()


(n, m) = map(int, input().split())
a = [0] * 101
for i in range(n):
	(x, y) = map(int, input().split())
	for j in range(x, y + 1):
		a[j] = 1
b = []
for i in range(1, m + 1):
	if a[i] == 0:
		b.append(i)
print(len(b))
for x in b:
	print(x, end=' ')


(n, m) = [int(s) for s in input().split()]
used = [0] * m
for i in range(n):
	(left, right) = [int(s) for s in input().split()]
	for j in range(left - 1, right):
		used[j] = 1
print(m - sum(used))
for i in range(m):
	if not used[i]:
		print(i + 1, end=' ')


(n, m) = input().split()
(n, m) = [int(n), int(m)]
ll = list()
rr = list()
mm = list()
for i in range(m):
	mm.append('no')
for i in range(n):
	(l, r) = input().split()
	(l, r) = [int(l), int(r)]
	ll.append(l)
	rr.append(r)
	for j in range(l, r + 1):
		mm[j - 1] = 'yes'
print(mm.count('no'))
for i in range(m):
	if mm[i] == 'no':
		print(i + 1, end=' ')


(n, m) = map(int, input().split())
points = []
for i in range(1, m + 1):
	points.append(i)
for i in range(n):
	(l, r) = map(int, input().split())
	for j in range(l, r + 1):
		if j in points:
			points.remove(j)
count = len(points)
if count > 0:
	for i in range(count):
		points[i] = str(points[i])
	points = ' '.join(points)
	print(count)
	print(points)
else:
	print(0)


l = list(map(int, input().split()))
a = l[0]
b = l[1]
p = []
for i in range(a):
	n = list(map(int, input().split()))
	x = n[0]
	y = n[1]
	for i in range(x, y + 1):
		p.append(i)
p.sort()
c = []
count = 0
for i in range(1, b + 1):
	if i not in p:
		count += 1
		c.append(i)
if count == 0:
	print(0)
else:
	print(count)
	for i in c:
		print(i, end=' ')


[n, m] = list(map(int, input().split()))
prim_list = [0] * m
for i in range(n):
	x = list(map(int, input().split()))
	x[0] = x[0] - 1
	x[1] = x[1] - 1
	for k in range(x[0], x[1] + 1, 1):
		prim_list[k] = 1
fin_list = []
for i in range(len(prim_list)):
	if prim_list[i] == 0:
		fin_list.append(i + 1)
l = len(fin_list)
if l == 0:
	print(0)
else:
	print(l)
	print(*fin_list)


(n, m) = map(int, input().split())
l = [0] * n
r = [0] * n
for i in range(n):
	(l[i], r[i]) = map(int, input().split())
k = 0
s = []
for x in range(1, m + 1):
	i = 0
	while i <= n - 1:
		if not (x >= l[i] and x <= r[i]):
			i += 1
		else:
			break
	if i == n:
		k += 1
		s.append(x)
if k != 0:
	print(k)
	print(*s)
else:
	print(0)


str_1 = input()
list_1 = str_1.split()
n = int(list_1[0])
m = int(list_1[1])
my_dict = dict.fromkeys(range(1, m + 1), 1)
for i in range(n):
	str_1 = input()
	list_1 = str_1.split()
	low_c = int(list_1[0])
	upper_c = int(list_1[1])
	for j in range(low_c, upper_c + 1):
		stop = my_dict.pop(j, 1)
my_list = []
count = 0
for key in my_dict.keys():
	my_list.append(key)
	count += 1
if count == 0:
	print(0)
else:
	my_list.sort()
	print(count)
	for i in my_list:
		print(i, end=' ')


(n, m) = tuple(map(int, input().split()))
array = [i for i in range(1, m + 1)]
covered = set()
for i in range(n):
	(l, r) = tuple(map(int, input().split()))
	for j in range(l, r + 1):
		covered.add(j)
ans = set(array) - covered
print(len(ans))
print(*ans)


(n, m) = map(int, input().split())
a = set()
for i in range(n):
	(l, r) = map(int, input().split())
	for j in range(l, r + 1):
		a.add(j)
print(m - len(a))
for i in range(1, m + 1):
	if i not in a:
		print(i, end=' ')


(n, m) = [int(i) for i in input().split()]
ar = [0] * (m + 1)
for i in range(n):
	(a, b) = [int(i) for i in input().split()]
	for x in range(a, b + 1):
		ar[x] += 1
k = 0
ans = list()
for x in range(1, m + 1):
	if ar[x] == 0:
		k += 1
		ans.append(x)
print(k)
for x in ans:
	print(x, end=' ')


(n, m) = map(int, input().split())
k = [x for x in range(1, m + 1)]
for _ in range(n):
	(l, r) = map(int, input().split())
	for x in range(l, r + 1):
		try:
			del k[k.index(x)]
		except ValueError:
			pass
not_found = len(k)
print(not_found)
if not_found == 0:
	exit(0)
print(*k, sep=' ')


(n, end_point) = map(int, input().split())
li = [list(map(int, input().split())) for i in range(n)]
all_points = list(range(1, end_point + 1))
for i in li:
	points_in = range(i[0], i[1] + 1)
	for j in points_in:
		if j in all_points:
			all_points.remove(j)
if all_points:
	print(len(all_points))
	for i in all_points:
		print(i, end=' ')
else:
	print(0)


(n, m) = map(int, input().split())
ans = set()
for i in range(1, m + 1):
	ans.add(i)
for i in range(n):
	(l, r) = map(int, input().split())
	for j in range(l, r + 1):
		if j in ans:
			ans.remove(j)
print(len(ans))
for i in ans:
	print(i, end=' ')
print()


first = list(map(int, input().split()))
third = []
forth = []
for i in range(first[0]):
	second = list(map(int, input().split()))
	if second[0] == second[1]:
		forth.append(second[0])
	else:
		for i in range(second[0], second[1] + 1):
			if i not in third:
				third.append(i)
for i in forth:
	if i not in third:
		third.append(i)
forth.clear()
for i in range(1, first[1] + 1):
	if i not in third:
		forth.append(i)
print(len(forth))
print(*forth)


q = input()
(n, m) = q.split()
n = int(n)
m = int(m)
e = []
no = []
for i in range(n):
	w = input()
	(z, x) = w.split()
	z = int(z)
	x = int(x)
	e.append(z)
	e.append(x)
	for i in range(x):
		if i > z and i < x:
			e.append(i)
for i in range(m + 1):
	if i not in e and i != 0:
		no.append(i)
print(len(no))
print(*no)


line = [int(k) for k in input().split()]
n = line[0]
limit = line[1]
points = list(range(1, limit + 1))
for i in range(n):
	line = [int(k) for k in input().split()]
	left = line[0] - 1
	right = line[1]
	for index in range(left, right):
		points[index] = -1
ans = list(filter(lambda a: a != -1, points))
print(len(ans))
print(*ans, sep=' ')


(n, m) = map(int, input().split())
l = []
c = 0
for i in range(105):
	l.append(0)
for i in range(n):
	(le, r) = map(int, input().split())
	for j in range(le, r + 1):
		l[j] = 1
for i in range(1, m + 1):
	if l[i] == 0:
		c += 1
print(c)
for i in range(1, m + 1):
	if l[i] == 0:
		print(i, end=' ')
print()


(n, m) = map(int, input().split())
a = []
for i in range(n):
	(l, r) = map(int, input().split())
	for j in range(l, r + 1):
		if j not in a:
			a.append(j)
k = []
i = 0
for i in range(1, m + 1):
	if i not in a:
		k.append(i)
if len(k) == 0:
	print('0')
else:
	print(len(k))
	print(*k)


(n, m) = map(int, input().split())
bounds = []
for i in range(n):
	(l, r) = map(int, input().split())
	bounds.append(set(range(l, r + 1)))
result = set(range(1, m + 1))
for bound in bounds:
	result = result - bound
print(len(result))
print(' '.join(map(str, result)))


(n, k) = map(int, input().split())
s1 = []
s2 = []
flag = 0
for i in range(n):
	s = list(map(int, input().split()))
	s1.append(s[0])
	s1.append(s[1])
for i in range(1, k + 1):
	flag = 0
	a = 0
	b = 1
	for j in range(1, n + 1):
		if i >= s1[a]:
			if i <= s1[b]:
				flag = 1
		a = a + 2
		b = b + 2
	if flag == 0:
		s2.append(i)
print(len(s2))
print(*s2)


from sys import stdin, stdout
(n, m) = tuple(map(int, stdin.readline().split()))
segments = [tuple(map(int, line.split())) for line in stdin]
points = [0] * (m + 1)
for (s, f) in segments:
	for i in range(s, f + 1):
		points[i] = 1
remain = []
for i in range(1, m + 1):
	if points[i] == 0:
		remain.append(str(i))
stdout.write(str(len(remain)))
stdout.write('\n' + ' '.join(remain))


a = [False] * 110
b = []
ans = 0
(n, m) = map(int, input().split())
for i in range(n):
	(l, r) = map(int, input().split())
	while l <= r:
		a[l] = True
		l += 1
for i in range(1, m + 1):
	if not a[i]:
		b.append(i)
		ans += 1
print(ans)
print(*b)


s = list(map(int, input().split()))
n = s[0]
m = s[1]
arr_main = [x for x in range(1, m + 1)]
arr2 = []
for i in range(0, n):
	s2 = list(map(int, input().split()))
	temp = [x for x in range(min(s2[0], s2[1]), max(s2[0], s2[1]) + 1)]
	arr2 = arr2 + temp
arr2 = list(set(arr2))
arr_final = set(arr_main) - set(arr2)
print(len(arr_final))
if len(arr_final) != 0:
	print(' '.join(list(map(str, arr_final))))


(n, m) = map(int, input().split())
arr = [False] * (m + 1)
for i in range(n):
	(a, b) = map(int, input().split())
	for i in range(a, b + 1):
		arr[i] = True
notinarr = []
for i in range(1, m + 1):
	if not arr[i]:
		notinarr.append(i)
print(len(notinarr))
print(' '.join(map(str, notinarr)))


(n, m) = map(int, input().split())
s = [list(map(int, input().split())) for i in range(n)]

def b(x):
	for i in range(n):
		if s[i][0] <= x and x <= s[i][1]:
			return False
	return True
ans = list(filter(b, [i for i in range(1, m + 1)]))
print(len(ans))
print(' '.join([str(x) for x in ans]))


(n, m) = map(int, input().split())
l = []
for i in range(n):
	l.append(list(map(int, input().split())))
exist = []
for i in l:
	for j in range(i[0], i[1] + 1):
		exist.append(j)
al = [i for i in range(1, m + 1)]
ans = []
for i in al:
	if i not in exist:
		ans.append(i)
print(len(ans))
print(*ans)


(n, m) = map(int, input().split())
l = set(range(1, m + 1))
for i in range(n):
	(a, b) = map(int, input().split())
	l -= set(range(a, b + 1))
print(len(l))
print(*l)


def hazf(x, y):
	global Alist
	for i in range(x, y + 1):
		Alist[i] = 1
	return
a = input()
for j in range(len(a)):
	if a[j] == ' ':
		A = [int(a[:j]), int(a[j + 1:])]
		break
Alist = [0] * A[1]
for i in range(A[0]):
	a = input()
	for j in range(len(a)):
		if a[j] == ' ':
			hazf(int(a[:j]) - 1, int(a[j + 1:]) - 1)
			break
ga1 = 0
ga2 = ''
for i in range(len(Alist)):
	if Alist[i] == 0:
		ga1 += 1
		ga2 += str(i + 1) + ' '
print(ga1)
print(ga2)


(n, m) = map(int, input().split())
s = set(range(1, m + 1))
for i in range(n):
	(a, b) = map(int, input().split())
	for x in range(a, b + 1):
		if x in s:
			s.remove(x)
print(len(s))
print(*s)


(n, m) = input().split()
(n, m) = [int(n), int(m)]
a = []
for i in range(0, n):
	a.append([int(i) for i in input().split()])
b = [0] * m
for i in range(0, n):
	for j in range(a[i][0], a[i][1] + 1):
		b[j - 1] = 1
c = 0
arr = []
for i in range(0, m):
	if b[i] != 1:
		c += 1
		arr.append(i + 1)
print(c)
print(*arr, sep=' ')


(n, k) = map(int, input().split())
arr = []
for i in range(1, k + 1):
	arr.append(i)
seta = set(arr)
arr1 = []
for j in range(n):
	(a, b) = map(int, input().split())
	for k in range(a, b + 1):
		arr1.append(k)
	seta1 = set(arr1)
	finalset = seta - seta1
if len(finalset) == 0:
	print(0)
else:
	print(len(finalset))
	kk = list(finalset)
	print(*kk)


(n, m) = map(int, input().split())
num = []
for i in range(n):
	(l, r) = map(int, input().split())
	num.append([l, r])
ans = []
for i in range(1, m + 1):
	for j in range(n):
		if num[j][0] <= i and num[j][1] >= i:
			break
	else:
		ans.append(i)
print(len(ans))
if ans:
	print(*ans)


(n, m) = map(int, input().split())
arr = []
for i in range(n):
	arr.append(list(map(int, input().split())))
a = list(range(1, m + 1))
for (j, k) in arr:
	for i in range(j, k + 1):
		if (i in a) == True:
			a.remove(i)
print(len(a))
for i in a:
	print(i, end=' ')


(m, n) = map(int, input().split())
aa = []
mmm = []
for i in range(101):
	mmm.append(0)
mmm[0] = 1
for i in range(n + 1, 101):
	mmm[i] = 1
for i in range(m):
	a = list(map(int, input().split()))
	for i in range(a[0], a[1] + 1, 1):
		mmm[i] = 1
otvet = 0
if 0 in mmm:
	for i in range(len(mmm)):
		if mmm[i] == 0:
			otvet += 1
			aa.append(i)
if otvet > 0:
	print(otvet)
	for i in range(len(aa)):
		print(aa[i], end=' ')
else:
	print(0)


(n, m) = map(int, input().split())
z = set(range(1, m + 1))
for u in range(n):
	(x, y) = map(int, input().split())
	for i in range(x, y + 1):
		z.discard(i)
print(len(z))
for i in z:
	print(i, end=' ')


def solve():
	(n, m) = [int(x) for x in input().split(' ')]
	leftover = [i + 1 for i in range(m)]
	to_be_removed = set()
	for i in range(n):
		(l, r) = [int(x) for x in input().split(' ')]
		to_be_removed.update([x for x in range(l, r + 1)])
	for x in to_be_removed:
		leftover.remove(x)
	length = len(leftover)
	print(length)
	if length != 0:
		for x in leftover:
			print(x, end=' ')
solve()


(n, m) = map(int, input().split())
a = [list(map(int, input().split())) for i in range(n)]

def c(x):
	for i in range(n):
		if a[i][0] <= x and x <= a[i][1]:
			return False
	return True
d = list(filter(c, [i for i in range(1, m + 1)]))
print(len(d))
print(*d)


(n, m) = [int(x) for x in input().split()]
a = [0] * (m + 2)
for z in range(n):
	(l, r) = [int(x) for x in input().split()]
	a[l] += 1
	a[r + 1] -= 1
ans = 0
fin = []
for i in range(1, m + 1):
	a[i] = a[i] + a[i - 1]
	if a[i] == 0:
		ans += 1
		fin.append(i)
print(ans)
for i in fin:
	print(i, end=' ')
print()


import sys
from itertools import accumulate

def input():
	return sys.stdin.readline().strip()

def list2d(a, b, c):
	return [[c] * b for i in range(a)]

def list3d(a, b, c, d):
	return [[[d] * c for j in range(b)] for i in range(a)]

def list4d(a, b, c, d, e):
	return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]

def ceil(x, y=1):
	return int(-(-x // y))

def INT():
	return int(input())

def MAP():
	return map(int, input().split())

def LIST(N=None):
	return list(MAP()) if N is None else [INT() for i in range(N)]

def Yes():
	print('Yes')

def No():
	print('No')

def YES():
	print('YES')

def NO():
	print('NO')
INF = 10 ** 18
MOD = 10 ** 9 + 7
(N, M) = MAP()
imos = [0] * (M + 2)
for _ in range(N):
	(l, r) = MAP()
	imos[l] += 1
	imos[r + 1] -= 1
imos = list(accumulate(imos))
ans = []
for i in range(1, M + 1):
	if not imos[i]:
		ans.append(i)
print(len(ans))
print(*ans)


(step, long) = map(int, input().split())
al = list(range(1, long + 1))
for i in range(step):
	(m, n) = map(int, input().split())
	for i in range(m, n + 1):
		if i in al:
			al.remove(i)
print(len(al))
print(*al)


(n, m) = map(int, input().split())
st = set([int(e) for e in range(1, m + 1)])
for i in range(n):
	(a, b) = map(int, input().split())
	for j in range(a, b + 1):
		try:
			st.remove(j)
		except KeyError:
			pass
print(len(st))
print(' '.join((str(e) for e in sorted(st))))


(a, b) = map(int, input().split())
i = 0
n = set()
for elem in range(1, b + 1):
	n.add(elem)
while i < a:
	(x, y) = map(int, input().split())
	j = 1
	while j <= b:
		if x <= j <= y:
			if j in n:
				n.remove(j)
		j += 1
	i += 1
print(len(n))
for elem in n:
	print(elem, end=' ')


(n, m) = map(int, input().split())
l = []
r = []
for i in range(n):
	(a, b) = map(int, input().split())
	for w in range(a, b + 1):
		l.append(w)
for i in range(1, m + 1):
	if i not in l:
		r.append(str(i))
print(m - len(set(l)))
print(' '.join(r))


(n, m) = map(int, input().split())
c = [False] * (m + 1)
for i in range(n):
	(x, y) = map(int, input().split())
	for j in range(x, y + 1):
		c[j] = True
count = 0
ans = ''
for i in range(1, m + 1):
	if c[i] == False:
		if count == 0:
			ans += f'{i}'
		else:
			ans += f' {i}'
		count += 1
print(count)
print(ans)


(n, m) = map(int, input().split())
sn = [0] * m
ans = m
for i in range(n):
	(l, r) = map(int, input().split())
	for i in range(l - 1, r):
		if sn[i] == 0:
			ans -= 1
		sn[i] = 1
print(ans)
for i in range(m):
	if sn[i] == 0:
		print(i + 1, end=' ')


(n, m) = map(int, input().split())
segs = []
for i in range(n):
	(a, b) = map(int, input().split())
	segs.append((a, b))
ps = []
for x in range(1, m + 1):
	l = False
	for (a, b) in segs:
		if a <= x <= b:
			l = True
	if not l:
		ps.append(x)
print(len(ps))
print(*ps)


l = input().split()
n = int(l[0])
m = int(l[1])
a = [0] * m
for i in range(n):
	(x, y) = input().split()
	x = int(x)
	y = int(y)
	for j in range(y - x + 1):
		a[x + j - 1] = 1
s = 0
k = ''
for i in range(m):
	s += a[i]
	if a[i] == 0:
		k += str(i + 1)
		k += ' '
print(m - s)
print(k)


def go():
	(n, m) = [int(i) for i in input().split(' ')]
	x = [0] * (m + 1)
	for i in range(n):
		a = [int(i) for i in input().split(' ')]
		for i in range(a[0], a[1] + 1):
			x[i] = 1
	o = ''
	c = 0
	for i in range(1, len(x)):
		if x[i] == 0:
			o += '{} '.format(i)
			c += 1
	print(c)
	return o.strip()
print(go())


(n, k) = map(int, input().split())
l = []
for i in range(n):
	(start, end) = map(int, input().split())
	for j in range(start, end + 1):
		l.append(j)
l = set(l)
print(k - len(l))
for i in range(1, k + 1):
	if not i in l:
		print(i, end=' ')


(n, m) = map(int, input().split())
arr = []
p = []
for k in range(0, n):
	(a, b) = map(int, input().split())
	for j in range(a, b + 1):
		arr.append(j)
arr = set(arr)
arr = list(arr)
arr.sort()
c = 0
counter = 0
l = len(arr)
for i in range(1, m + 1):
	if l == 0:
		break
	if i == arr[c] and c < l:
		if c < l - 1:
			c = c + 1
	else:
		p.append(i)
		counter = counter + 1
print(counter)
if len(p) != 0:
	for i in range(0, len(p)):
		if i == len(p) - 1:
			print(p[i])
		else:
			print(p[i], end=' ')


nm = input().split()
n = int(nm[0])
m = int(nm[1])
seg = []
fora = []

def inSeg(x, seg):
	for pontos in seg:
		if x > pontos[0] - 1 and x < pontos[1] + 1:
			return True
	return False
for i in range(n):
	seg.append(input().split())
	seg[i] = [int(x) for x in seg[i]]
for x in range(1, m + 1):
	esta = inSeg(x, seg)
	if esta == False:
		fora.append(x)
print(len(fora))
if len(fora) > 0:
	for num in fora:
		print(num, end=' ')


import sys
(num, bound) = map(int, sys.stdin.readline().split())
sex = set()
for i in range(num):
	(a, b) = map(int, sys.stdin.readline().split())
	for j in range(a, b + 1):
		sex.add(j)
sys.stdout.write('{}\n'.format(bound - len(sex)))
for i in range(1, bound + 1):
	if i not in sex:
		sys.stdout.write('{} '.format(i))


from collections import Counter
f = lambda : map(int, input().split())
(n, m) = f()
visited = [False] * (m + 1)
for i in range(n):
	(l, r) = f()
	for j in range(l, r + 1):
		visited[j] = True
count = 0
res = []
for j in range(1, m + 1):
	if not visited[j]:
		res.append(j)
		count += 1
print(count)
print(*res)


(m, n) = map(int, input().split())
s = set(range(1, n + 1))
for _ in range(m):
	(x, y) = map(int, input().split())
	s -= set(range(x, y + 1))
print(len(s))
print(*s)


import os
import sys
from io import BytesIO, IOBase
import math
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
(n, m) = map(int, input().split())
al = list()
for i in range(n):
	(l, r) = map(int, input().split())
	for j in range(l, r + 1):
		al.append(j)
na = list(set(al))
na.sort()
print(m - len(na))
for i in range(1, m + 1):
	if i not in na:
		print(i, end=' ')
print()


import sys
import os
from io import IOBase, BytesIO

def main():
	(n, m) = get_ints()
	arr = [0] * (m + 1)
	for _ in range(n):
		(l, r) = get_ints()
		for i in range(l, r + 1):
			arr[i] = 1
	ans = []
	for i in range(1, m + 1):
		if arr[i] == 0:
			ans.append(i)
	print(len(ans))
	print(*ans)
BUFSIZE = 8192

class FastIO(BytesIO):
	newlines = 0

	def __init__(self, file):
		self._file = file
		self._fd = file.fileno()
		self.writable = 'x' in file.mode or 'w' in file.mode
		self.write = super(FastIO, self).write if self.writable else None

	def _fill(self):
		s = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
		self.seek((self.tell(), self.seek(0, 2), super(FastIO, self).write(s))[0])
		return s

	def read(self):
		while self._fill():
			pass
		return super(FastIO, self).read()

	def readline(self):
		while self.newlines == 0:
			s = self._fill()
			self.newlines = s.count(b'\n') + (not s)
		self.newlines -= 1
		return super(FastIO, self).readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.getvalue())
			(self.truncate(0), self.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		py2 = round(0.5)
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		if py2 == 1:
			self.write = self.buffer.write
			self.read = self.buffer.read
			self.readline = self.buffer.readline
		else:
			self.write = lambda s: self.buffer.write(s.encode('ascii'))
			self.read = lambda : self.buffer.read().decode('ascii')
			self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))

def get_array():
	return list(map(int, sys.stdin.readline().split()))

def get_ints():
	return map(int, sys.stdin.readline().split())

def input():
	return sys.stdin.readline().strip()
main()


(n, m) = input().split(' ')
n = int(n)
m = int(m)
marked = [0] * m
for i in range(n):
	(l, r) = input().split(' ')
	for k in range(int(l) - 1, int(r)):
		marked[k] = 1
answer = [i + 1 for (i, x) in enumerate(marked) if x == 0]
if len(answer) == 0:
	print(0)
else:
	print(len(answer))
	for item in answer:
		print(item, end=' ')


from sys import stdin, stdout, exit as sys_ret
(f_input, f_print, f_flush) = (stdin.readline, stdout.write, stdout.flush)

def the_good(amount, border, segments):
	intersection = [0 for i in range(border + 2)]
	for i in segments:
		intersection[i[0]] += 1
		intersection[i[1] + 1] -= 1
	for i in range(1, border + 1):
		intersection[i] += intersection[i - 1]
	ans = [i for i in range(1, border + 1) if intersection[i] == 0]
	f_print(str(len(ans)) + '\n')
	for i in ans:
		f_print(str(i) + ' ')

def the_bad(amount, border, segments):

	def bad(x):
		return False if len([i for i in segments if i[0] <= x and x <= i[1]]) else True
	ans = list(filter(bad, [i for i in range(1, border + 1)]))
	f_print(str(len(ans)) + '\n')
	f_print(' '.join([str(x) for x in ans]))

def the_ugly(amount, border, segments):
	ans = []
	for i in range(1, border + 1):
		flag = 0
		for j in segments:
			if j[0] <= i and i <= j[1]:
				flag = 1
				break
		if flag == 0:
			ans.append(i)
	f_print(str(len(ans)) + '\n')
	for i in ans:
		f_print(str(i) + ' ')
(amount, border) = map(int, f_input().split())
segments = [[int(__) for __ in f_input().split()] for _ in range(amount)]
the_good(amount, border, segments)


(n, m) = map(int, input().split())
a = list()
for i in range(n):
	a.append(tuple(map(int, input().split())))
b = [True] * (m + 1)
b[0] = False
for i in a:
	for j in range(i[0], i[1] + 1):
		b[j] = False
ans = list()
for i in range(len(b)):
	if b[i]:
		ans.append(i)
print(len(ans))
print(*ans)


(n, m) = map(int, input().strip().split())
s = set()
res = []
for _ in range(n):
	(a, b) = map(int, input().strip().split())
	for j in range(a, b + 1):
		s.add(j)
for i in range(1, m + 1):
	if i not in s:
		res.append(i)
print(len(res))
print(*res)


(n, m) = map(int, input().split())
s = set(range(1, m + 1))
for _ in range(n):
	(a, b) = map(int, input().split())
	s -= set(range(a, b + 1))
print(len(s))
print(*s)


(n, m) = map(int, input().split())
a = [tuple(map(int, input().split())) for _ in range(n)]
sol = list(range(1, m + 1))
for i in a:
	for (j, e) in enumerate(sol):
		if i[0] <= e <= i[1]:
			sol[j] = -1
sol = list(filter(lambda x: x > 0, sol))
print(len(sol))
print(' '.join(map(str, sol)))


(n, m) = map(int, input().split())
l = [i for i in range(1, m + 1)]
for i in range(n):
	(j, k) = input().split()
	for i in range(int(j), int(k) + 1):
		if i in l:
			l.remove(i)
print(len(l))
print(*l)


nm = list(map(int, input().split()))
n = nm[0]
m = nm[1]
a = []
ans = [-1 for i in range(m)]
am = m
for i in range(n):
	a.append(list(map(int, input().split())))
for i in range(n):
	while a[i][1] >= a[i][0]:
		if ans[a[i][1] - 1] == -1:
			am -= 1
		ans[a[i][1] - 1] = a[i][1] - 1
		a[i][1] -= 1
print(am)
for i in range(m):
	if ans[i] == -1:
		print(i + 1, end=' ')


(n, m) = [int(x) for x in input().split()]
a = []
for x in range(1, m + 1):
	a.append(x)
for x in range(n):
	(l, r) = [int(x) for x in input().split()]
	for y in range(l, r + 1):
		if y in a:
			a.pop(a.index(y))
print(len(a))
for x in range(len(a)):
	print(a[x], end=' ')


import sys
import math
import os
import itertools
import string
import heapq
import _collections
from collections import Counter
from collections import defaultdict
from functools import lru_cache
import bisect
import re
import queue
from decimal import *

class Scanner:

	@staticmethod
	def int():
		return int(sys.stdin.readline().rstrip())

	@staticmethod
	def string():
		return sys.stdin.readline().rstrip()

	@staticmethod
	def map_int():
		return [int(x) for x in Scanner.string().split()]

	@staticmethod
	def string_list(n):
		return [input() for i in range(n)]

	@staticmethod
	def int_list_list(n):
		return [Scanner.map_int() for i in range(n)]

	@staticmethod
	def int_cols_list(n):
		return [int(input()) for i in range(n)]

class Math:

	@staticmethod
	def gcd(a, b):
		if b == 0:
			return a
		return Math.gcd(b, a % b)

	@staticmethod
	def lcm(a, b):
		return a * b // Math.gcd(a, b)

	@staticmethod
	def divisor(n):
		res = []
		i = 1
		for i in range(1, int(n ** 0.5) + 1):
			if n % i == 0:
				res.append(i)
				if i != n // i:
					res.append(n // i)
		return res

	@staticmethod
	def round_up(a, b):
		return -(-a // b)

	@staticmethod
	def is_prime(n):
		if n < 2:
			return False
		if n == 2:
			return True
		if n % 2 == 0:
			return False
		d = int(n ** 0.5) + 1
		for i in range(3, d + 1, 2):
			if n % i == 0:
				return False
		return True

class PriorityQueue:

	def __init__(self, l=[]):
		self.q = l
		heapq.heapify(self.q)
		return

	def push(self, n):
		heapq.heappush(self.q, n)
		return

	def pop(self):
		return heapq.heappop(self.q)

def pop_count(x):
	x = x - (x >> 1 & 6148914691236517205)
	x = (x & 3689348814741910323) + (x >> 2 & 3689348814741910323)
	x = x + (x >> 4) & 1085102592571150095
	x = x + (x >> 8)
	x = x + (x >> 16)
	x = x + (x >> 32)
	return x & 127
MOD = int(1000000000.0) + 7
INF = int(1000000000000000.0)

def main():
	(N, M) = Scanner.map_int()
	A = [0 for _ in range(M + 1)]
	for _ in range(N):
		(l, r) = Scanner.map_int()
		l -= 1
		A[l] += 1
		A[r] -= 1
	for i in range(1, M + 1):
		A[i] += A[i - 1]
	A = A[:M]
	ans = []
	for (i, a) in enumerate(A):
		if a == 0:
			ans.append(i + 1)
	print(len(ans))
	print(*ans)
main()


(n, m) = map(int, input().split())
List = [0 for i in range(m)]
List1 = []
for i in range(n):
	(x, y) = map(int, input().split())
	for i in range(x - 1, y):
		List[i] = 1
for i in range(m):
	if List[i] == 0:
		List1.append(i + 1)
print(len(List1))
print(*List1)


(n, m) = map(int, input().split())
result = set(range(1, m + 1))
for i in range(n):
	(left, right) = map(int, input().split())
	result -= set(range(left, right + 1))
print(len(result))
print(' '.join(map(str, result)))


(n, m) = map(int, input().split())
l2 = []
for i in range(n):
	(l, r) = map(int, input().split())
	while l <= r:
		l2.append(l)
		l += 1
c = m
a = ''
for y in range(m):
	if y + 1 in l2:
		c -= 1
	else:
		a += str(y + 1) + ' '
print(c)
print(a)


(n, m) = map(int, input().split())
a = list(range(1, m + 1))
i = []
for _ in range(n):
	(l, r) = map(int, input().split())
	i.extend(list(range(l, r + 1)))
i = list(set(i))
i.sort()
n0 = len(i)
k = j = 0
p = []
while j < n0:
	if i[j] != a[k]:
		p.append(a[k])
		k += 1
	else:
		k += 1
		j += 1
p.extend(a[k:])
print(len(p))
print(' '.join(map(str, p)))


k = []
s1 = []
s = 0
(a, b) = map(int, input().split())
for i in range(a):
	(c, d) = map(int, input().split())
	for j in range(d - c + 1):
		k.append(j + c)
for i in range(1, b + 1):
	for j in range(len(k)):
		if k[j] == i:
			break
		if j == len(k) - 1:
			s = s + 1
			s1.append(i)
print(s)
for i in s1:
	print(i, end=' ')


import math
import os
import random
import re
import sys
a = input().split()
n = int(a[0])
m = int(a[1])
l = []
for i in range(1, m + 1):
	l.append(i)
for i in range(n):
	b = input().split()
	x = int(b[0])
	y = int(b[1])
	for j in range(x, y + 1):
		if j in l:
			l.remove(j)
print(len(l))
if len(l) != 0:
	print(*l, sep=' ')


(n, m) = map(int, input().split())
a = []
res = []
for _ in range(n):
	(l, r) = map(int, input().split())
	a.append((l, r + 1))
for i in range(1, m + 1):
	flag = True
	for j in a:
		if i in range(j[0], j[1]):
			flag = False
			break
	if flag:
		res.append(i)
print(len(res))
print(*res)


(n, m) = map(int, input().split())
a = [0] * m
for i in range(n):
	(l, r) = map(int, input().split())
	for j in range(l, r + 1):
		a[j - 1] = 1
k = 0
for i in range(len(a)):
	if a[i] == 0:
		k += 1
print(k)
for i in range(len(a)):
	if a[i] == 0:
		print(i + 1, end=' ')


(n, m) = list(map(int, input().split()))
l = list()
r = list()
h = list()
h2 = list()
for i in range(0, n):
	inp = list(map(int, input().split()))
	l.append(inp[0])
	r.append(inp[1])
for i in range(0, n):
	for j in range(l[i], r[i] + 1):
		h.append(j)
for i in range(1, m + 1):
	if i not in h:
		h2.append(i)
if len(h2) != 0:
	print(len(h2))
	for i in range(0, len(h2)):
		print(h2[i], end=' ')
	print()
else:
	print(len(h2))


(n, m) = map(int, input().split())
r = [True] * m
for k in range(n):
	(a, b) = map(int, input().split())
	for i in range(a - 1, b):
		r[i] = False
c = 0
s = ''
for a in range(len(r)):
	if r[a]:
		s += str(a + 1) + ' '
		c += 1
print(c)
if c != 0:
	print(s[:-1])


from sys import stdin
from functools import reduce
(n, m) = tuple(map(int, input().split()))
segments = [tuple(map(int, line.split())) for line in stdin.readlines()]
ans = list(reduce(lambda nums, p: filter(lambda x: x < p[0] or p[1] < x, nums), segments, range(1, m + 1)))
print(len(ans))
print(*ans)


(q, w) = map(int, input().split())
e = [0] * 200
for i in range(q):
	(r, t) = map(int, input().split())
	if r == t:
		e[t] = 1
	else:
		for j in range(r, t + 1):
			e[j] = 1
v = 0
b = []
for i in range(1, w + 1):
	if e[i] == 0:
		v += 1
		b.append(i)
print(v)
print(*b)


(n, m) = map(int, input().split())
l = []
ans = []
for i in range(n):
	(a, b) = map(int, input().split())
	ans.append([a, b])
ans.sort()
f = 0
for i in range(1, m + 1):
	f = 0
	for j in range(len(ans)):
		if i >= ans[j][0] and i <= ans[j][1]:
			f = 1
			break
	if f == 0:
		l.append(i)
if len(l) != 0:
	print(len(l))
	print(*l)
else:
	print('0')


(n, m) = map(int, input().split())
points = list((i for i in range(1, m + 1)))
for _ in range(n):
	(l, r) = map(int, input().split())
	for i in range(l, r + 1):
		if i in points:
			points.remove(i)
print(len(points))
for i in points:
	print(i, end=' ')


R = lambda : map(int, input().strip().split())
(n, m) = R()
bs = [True] * m
for i in range(n):
	(l, r) = R()
	bs[l - 1:r] = [False] * (r - l + 1)
ans = [i + 1 for (i, x) in enumerate(bs) if x]
print(len(ans))
print(*ans)


(n, m) = map(int, input().split())
a = []
c = []
i = 0
b = [*range(1, m + 1)]
while i < n:
	(k, l) = map(int, input().split())
	for j in range(k, l + 1):
		a.append(j)
	i += 1
for i in b:
	if i not in a:
		c.append(i)
print(len(c))
for i in c:
	print(i, end=' ')


(n, m) = [int(i) for i in input().split()]
lst = []
while n:
	n -= 1
	(l, r) = [int(i) for i in input().split()]
	for i in range(l, r + 1):
		lst.append(i)
lst = list(set(lst))
(s, c) = ('', 0)
for i in range(1, m + 1):
	if i not in lst:
		c += 1
		s += str(i) + ' '
print(c)
print(s)


(n, m) = list(map(int, input().split()))
all = set(range(1, m + 1))
for i in range(n):
	(l, r) = list(map(int, input().split()))
	for j in range(l, r + 1):
		all.discard(j)
print(len(all))
print(*all)


(n, m) = map(int, input().split())
set_seg = set()
for i in range(0, n):
	(a, b) = map(int, input().split())
	li = range(a, b + 1)
	set_seg.update(li)
num_mis = m - len(set_seg)
if num_mis != 0:
	print(num_mis)
	for i in range(1, m + 1):
		if i not in set_seg:
			print(i, end=' ')
else:
	print(0)


(n, m) = map(int, input().split())
points = [True for _ in range(m + 1)]
for _ in range(n):
	(l, r) = map(int, input().split())
	for x in range(l, r + 1):
		points[x] = False
ans = []
for x in range(1, m + 1):
	if points[x]:
		ans.append(str(x))
print(len(ans))
print(' '.join(ans))


(n, m) = map(int, input().split())
b = []
c = []
for i in range(n):
	(a, a1) = map(int, input().split())
	if a == a1:
		b.append(a)
	else:
		for i in range(a, a1 + 1):
			if i not in b:
				b.append(i)
for i in range(1, m + 1):
	if i not in b:
		c.append(i)
if len(c) == 0:
	print(0)
else:
	print(len(c))
	for i in c:
		print(i, end=' ')


(n, m) = map(int, input().split())
rangeAr = [0] * m
zeroNum = 0
for i in range(n):
	(a, b) = map(int, input().split())
	a -= 1
	b -= 1
	for j in range(a, b + 1):
		if rangeAr[j] == 0:
			zeroNum += 1
		rangeAr[j] = 1
print(m - zeroNum)
for i in range(0, m):
	if rangeAr[i] == 0:
		print(i + 1, end=' ')


(n, m) = map(int, input().split())
li = [-1] * (m + 1)
li[0] = 0
for x in range(n):
	(l, r) = map(int, input().split())
	for i in range(l, r + 1):
		li[i] = 0
print(li.count(-1))
flag = False
for i in range(1, m + 1):
	if li[i] == -1:
		print(i, end=' ')
		flag = True
if flag == False:
	print(' ')


(n, m) = map(int, input().split())
arr = [1] * (m + 1)
for i in range(n):
	(l, r) = map(int, input().split())
	for j in range(l, r + 1):
		arr[j] = 0
ans = list()
for i in range(1, len(arr)):
	if arr[i] == 1:
		ans.append(i)
print(len(ans))
print(*ans)


(n, m) = [int(a) for a in input().split()]
k = 0
data = []
res = []
for i in range(n):
	data.append([int(b) for b in input().split()])
for num in range(1, m + 1):
	j = 0
	for i in range(n):
		if num < data[i][0] or num > data[i][1]:
			j += 1
		else:
			break
	if j == n:
		res.append(num)
print(len(res))
for r in res:
	print(r, end=' ')
print('\n')


(n, m) = map(int, input().split())
p = []
for i in range(n):
	x = list(map(int, input().split()))
	p.append(x)
t = []
for i in range(1, m + 1):
	t.append(i)
for i in range(0, n):
	for j in range(p[i][0], p[i][1] + 1):
		if j in t:
			t.remove(j)
print(len(t))
for i in range(len(t)):
	print(t[i], end=' ')


(n, m) = map(int, input().split())
l = []
for i in range(101):
	l.append(0)
for i in range(n):
	(x, y) = map(int, input().split())
	for j in range(x, y + 1):
		l[j] = 1
c = 0
for i in range(1, m + 1):
	if l[i] == 0:
		c += 1
print(c)
for i in range(1, m + 1):
	if l[i] == 0:
		print(i, end=' ')


(n, m) = map(int, input().split())
li = [i for i in range(1, m + 1)]
while n:
	(l, r) = map(int, input().split())
	for i in range(l, r + 1):
		if i in li:
			li.remove(i)
	n -= 1
size = len(li)
if size > 0:
	print(size)
	for i in range(size):
		print(li[i], end=' ')
else:
	print(0)


(n, m) = map(int, input().split())
a = [0] * m
for i in range(n):
	(ai, bi) = map(int, input().split())
	for j in range(ai - 1, bi):
		a[j] += 1
print(a.count(0))
b = []
for i in range(m):
	if a[i] == 0:
		b.append(i + 1)
print(*b)


def belongs_to_segment(segments, p):
	for (start, end) in segments:
		if start <= p <= end:
			return True
	return False

def find_free_points(segments, m):
	result = []
	for p in range(1, m + 1):
		if not belongs_to_segment(segments, p):
			result.append(p)
	return result
(n, m) = map(int, input().strip().split())
segments = []
for _ in range(n):
	(start, end) = map(int, input().strip().split())
	segments.append((start, end))
result = find_free_points(segments, m)
print(len(result))
print(' '.join(map(str, result)))


def i_ints():
	return map(int, input().split())
(n, m) = i_ints()
points = set(range(1, m + 1))
for i in range(n):
	(l, r) = i_ints()
	points.difference_update(range(l, r + 1))
print(len(points))
print(' '.join(map(str, points)))


(n_of_segments, x_max) = [int(inp) for inp in input().split(' ')]
full_segment = set([i for i in range(1, x_max + 1)])
partial_segment = set()
for segment in range(n_of_segments):
	(x1, x2) = [int(inp) for inp in input().split(' ')]
	for x in range(x1, x2 + 1):
		partial_segment.add(x)
final_points = list(full_segment.difference(partial_segment))
print(len(final_points))
if len(final_points) > 0:
	print(' '.join(list(map(str, final_points))))


ler = input('')
ler = ler.split()
n = int(ler[0])
m = int(ler[1])
v = []
for i in range(m):
	v.append(i + 1)
for j in range(n):
	p = input('')
	p = p.split()
	l = int(p[0])
	r = int(p[1])
	aux = []
	for h in range(l, r + 1):
		aux.append(h)
	for bb in aux:
		if bb in v:
			v.remove(bb)
print(len(v))
if len(v) == 0:
	quit()
else:
	for numero in v:
		print(numero, end=' ')
print('')


(n, m) = map(int, input().split())
a = []
b = []
c = []
for j in range(n):
	b = []
	(x, y) = map(int, input().split())
	b.append(x)
	b.append(y)
	a.append(b)
for k in range(1, m + 1):
	temp = 0
	for i in range(len(a)):
		if k >= a[i][0] and k <= a[i][1]:
			temp = 1
		if temp == 1:
			break
	if temp == 0:
		c.append(k)
f = len(c)
print(f)
for i in range(f):
	print(c[i], end=' ')


(n, m) = map(int, input().split())
c = [i for i in range(1, m + 1)]
c2 = []
for i in range(n):
	(a, b) = map(int, input().split())
	for i in range(a, b + 1):
		c2.append(i)
C = list(set(c) - set(c2))
print(len(C))
for i in C:
	print(i, end=' ')


(n, m) = map(int, input().split())
a = set(range(1, m + 1))
for i in range(n):
	(l, r) = map(int, input().split())
	a -= set(range(l, r + 1))
print(len(a))
print(' '.join(map(str, a)))


(n, m) = map(int, input().split())
a = [*range(1, m + 1)]
for _ in '0' * n:
	(i, j) = map(int, input().split())
	a = [x for x in a if x not in range(i, j + 1)]
print(len(a))
print(*a)


n = [int(x) for x in input().split()]
l = [i for i in range(1, n[1] + 1)]
for k in range(n[0]):
	p = [int(x) for x in input().split()]
	for j in range(p[0], p[1] + 1):
		if j in l:
			l.remove(j)
print(len(l))
for e in l:
	print(e, end=' ')


io = input().split()
n = int(io[0])
m = int(io[1])
line = []
for i in range(m):
	line.append(0)
for i in range(n):
	io = input().split()
	l = int(io[0])
	r = int(io[1])
	div = r - l + 1
	for j in range(div):
		line[l - 1 + j] = 1
count = 0
res = []
for i in range(m):
	if line[i] == 0:
		count += 1
		res.append(i + 1)
print(count)
print(' '.join(map(str, res)))


(n, u) = map(int, input().split())
s = ''
l = [i for i in range(1, u + 1)]
for _ in range(n):
	(a, b) = map(int, input().split())
	for j in range(a - 1, b):
		l[j] = 0
p = set(l)
if len(p) == 1:
	print('0')
else:
	q = ' '.join(map(str, l))
	l = list(filter(lambda a: a != 0, l))
	print(len(l))
	print(*l)


(n, k) = map(int, input().split())
l = [0]
l = l * k
for i in range(n):
	(x, y) = map(int, input().split())
	for j in range(x - 1, y):
		l[j] = 1
w = 0
q = []
for i in range(k):
	if l[i] == 0:
		w += 1
		q.append(i + 1)
print(w)
for i in q:
	print(i, end=' ')


(n, m) = map(int, input().split())
a = []
b = []
for i in range(n):
	(l, r) = map(int, input().split())
	for j in range(l, r + 1):
		if not j in a:
			a += [j]
for g in range(1, m + 1):
	if not g in a:
		b += [g]
c = len(b)
print(c)
if c > 0:
	for h in range(c):
		print(b[h], end=' ')
else:
	print()


(n, m) = map(int, input().split())
a = [list(map(int, input().split())) for i in range(n)]
ans = 0
answ = []
for i in range(1, m + 1):
	flag = False
	for elem in a:
		flag |= elem[0] <= i <= elem[1]
	ans += not flag
	if not flag:
		answ.append(i)
print(ans)
print(*answ)


L = [int(i) for i in input().strip().split()]
n = L[0]
m = L[1]
set = set([])
for i in range(m):
	set.add(i + 1)
for i in range(n):
	L2 = [int(i) for i in input().strip().split()]
	t = L2[0]
	r = L2[1]
	for i in range(t, r + 1):
		if i in set:
			set.remove(i)
count = 0
for i in set:
	count += 1
print(count)
for i in set:
	print(i, end=' ')


(otrezki, final) = map(int, input().split())
counter = [0] * final
for i in range(1, otrezki + 1):
	(start, finish) = map(int, input().split())
	for j in range(1, final + 1):
		if start <= j <= finish:
			counter[j - 1] += 1
print(counter.count(0))
for i in range(len(counter)):
	if counter[i] == 0:
		print(i + 1, end=' ')


(n, m) = map(int, input().split())
save_point = {}
for _ in range(n):
	(x, y) = map(int, input().split())
	for i in range(x, y + 1):
		if i not in save_point:
			save_point[i] = 1
count = 0
ans = []
for i in range(1, m + 1):
	if i not in save_point:
		count += 1
		ans.append(i)
if count == 0:
	print(0)
else:
	print(count)
	print(*ans)


(n, m) = map(int, input().split())
f = [0] * (m + 1)
for i in range(n):
	(x, y) = map(int, input().split())
	for j in range(1, m + 1):
		if x <= j <= y:
			f[j] = 1
ans = 0
for i in range(1, m + 1):
	if not f[i]:
		ans += 1
print(ans)
for i in range(1, m + 1):
	if not f[i]:
		print(i, end=' ')


nm = input()
b = nm.split()
n = int(b[0])
m = int(b[1])
segments = []
for i in range(n):
	segments.append(list(input().split()))
points = []
for a in segments:
	if a[0] != a[1]:
		for i in range(int(a[0]), int(a[1]) + 1):
			if i not in points:
				points.append(i)
	elif a[0] not in points:
		points.append(int(a[0]))
points = sorted(points)
rest_points = []
for i in range(1, m + 1):
	if i not in points:
		rest_points.append(i)
print(len(rest_points))
for i in rest_points:
	print(i, end=' ')


(n, m) = map(int, input().split())
l = list(range(1, m + 1))
d = []
for u in range(n):
	(x, y) = map(int, input().split())
	for i in range(x, y + 1):
		d.append(i)
w = []
for i in l:
	if i not in d:
		w.append(i)
a = len(w)
if a == 0:
	print(0)
else:
	print(a)
	print(*w)


def _main():
	(n, m) = list(map(int, input().split()))
	a = [0] * n
	for i in range(n):
		a[i] = list(map(int, input().split()))
	ans = []
	for i in range(1, m + 1):
		t = False
		for j in a:
			if j[0] <= i and j[1] >= i:
				t = True
		if t == False:
			ans.append(i)
	print(len(ans))
	print(*ans)
_main()


(n, m) = [int(x) for x in input().split()]
a = [False] * m
for i in range(n):
	(x, y) = [int(x) for x in input().split()]
	for i in range(x, y + 1):
		a[i - 1] = True
l = 0
for i in range(m):
	if not a[i]:
		l += 1
print(l)
for i in range(m):
	if not a[i]:
		print(i + 1, end=' ')


(n, m) = map(int, input().split())
found = [False for x in range(m + 1)]
for _ in range(n):
	(l, r) = map(int, input().split())
	for i in range(l, r + 1):
		found[i] = True
missing = list((x for x in range(1, m + 1) if not found[x]))
print(len(missing))
print(' '.join(map(str, missing)))


(n, m) = map(int, input().split())
l = [' ' for _ in range(n)]
r = [' ' for _ in range(n)]
for i in range(n):
	(l[i], r[i]) = map(int, input().split())
lst = [i for i in range(1, m + 1)]
for i in range(n):
	temp = l[i]
	while temp <= r[i]:
		if temp in lst:
			lst.remove(temp)
		temp += 1
print(len(lst))
for item in lst:
	print(item, end=' ')


def mi():
	return map(int, input().split())
(n, m) = mi()
a = [0] * m
for i in range(n):
	(l, r) = mi()
	for i in range(l - 1, r):
		a[i] = 1
print(a.count(0))
for i in range(m):
	if a[i] == 0:
		print(i + 1, end=' ')


(n, m) = map(int, input().split())
total_list = []
points = []
l = []
for i in range(n):
	l.append(list(map(int, input().split())))
for i in range(1, m + 1):
	for j in l:
		for x in range(j[0], j[1] + 1):
			if i == x:
				points.append(i)
for i in range(1, m + 1):
	if i not in points:
		total_list.append(i)
print(len(total_list))
print(*total_list)


first = input()
first = first.split()
count = int(first[0])
m = int(first[1])
d = {}
for i in range(1, m + 1):
	d[i] = 0
j = 0
for j in range(count):
	string = input()
	string = string.split()
	a = int(string[0])
	b = int(string[1])
	for k in range(a, b + 1):
		d[k] = 1
out = 0
numbers = ''
for i in range(1, m + 1):
	if d[i] == 0:
		out += 1
		add = str(i) + ' '
		numbers += add
print(out)
print(numbers)


(n, m) = input().split()
n = int(n)
m = int(m)
l = list(range(1, m + 1))
for i in range(n):
	(lis, r) = input().split()
	lis = int(lis)
	r = int(r)
	if len(l) == 0:
		continue
	for j in range(lis, r + 1):
		if j in l:
			l.remove(j)
print(len(l))
if len(l) != 0:
	print(*l)


(n, m) = input().split()
n = int(n)
m = int(m)
x = [0 for i in range(0, m + 1)]
for i in range(n):
	(a, b) = input().split()
	a = int(a)
	b = int(b)
	for j in range(a, b + 1):
		x[j] = 1
count = 0
arr = []
for i in range(1, m + 1):
	if x[i] == 0:
		count += 1
		arr.append(i)
print(count)
for i in range(len(arr)):
	print(arr[i], end=' ')


(n, m) = map(int, input().split())
vis = []
for i in range(m + 1):
	vis.append(0)
for i in range(n):
	(l, r) = map(int, input().split())
	for cnt in range(l, r + 1):
		vis[cnt] = 1
num = 0
for i in range(1, m + 1):
	if vis[i] == 0:
		num += 1
print(num)
for i in range(1, m + 1):
	if vis[i] == 0:
		print(i, end=' ')


(a, b) = map(int, input().split())
x = []
y = []
for i in range(a):
	(c, d) = map(int, input().split())
	for i in range(1, b + 1):
		if i >= c and i <= d:
			x.append(i)
for i in range(1, b + 1):
	if i not in x:
		y.append(i)
print(len(y))
print(*y)


(n, m) = map(int, input().split())
check = [0] * (m + 1)
for i in range(n):
	(a, b) = map(int, input().split())
	while a <= b:
		check[a] = 1
		a += 1
points = []
for i in range(1, m + 1):
	if check[i] == 0:
		points.append(i)
print(len(points))
print(*points, sep=' ')


(n, m) = list(map(int, input().split()))
a = {}
for i in range(n):
	(l, r) = list(map(int, input().split()))
	for j in range(l, r + 1):
		if j in a:
			a[j] += 1
		else:
			a[j] = 1
c = []
for i in range(1, m + 1):
	if i not in a:
		c.append(i)
print(len(c))
print(*c)


def get_list_of_nums(string, delim=' '):
	array = string.split(delim)
	return list(map(int, array))
(n, m) = get_list_of_nums(input())
dots = []
for i in range(n):
	dots.append(get_list_of_nums(input()))
all_dots = []
for pair in dots:
	all_dots += list(range(pair[0], pair[1] + 1))
nums = set(all_dots)
possible_vals = set(list(range(1, m + 1))) - nums
print(len(possible_vals))
if len(possible_vals):
	answ = ''
	for val in possible_vals:
		answ += str(val) + ' '
	print(answ[:-1])


(N, M) = [int(x) for x in input().split()]
arr = [0] * M
res = []
count = 0
for i in range(0, N):
	(A, B) = [int(x) for x in input().split()]
	for i in range(A, B + 1):
		arr[i - 1] = 1
for i in range(0, len(arr)):
	if arr[i] == 0:
		count = count + 1
		res.append(i + 1)
print(count)
for i in range(0, len(res)):
	print(res[i], end=' ')


(n, m) = map(int, input().split())
a = [0] * (m + 1)
for i in range(n):
	(l, r) = map(int, input().split())
	for j in range(l, r + 1):
		if a[j] == 0:
			a[j] = 1
count = 0
res = []
for i in range(1, m + 1):
	if a[i] == 0:
		count += 1
		res.append(i)
print(count)
for each in res:
	print(each, end=' ')


(n, m) = [int(i) for i in input().split()]
skobki = []
for i in range(n):
	(l, r) = [int(i) for i in input().split()]
	skobki.append((l, r))
skobki.sort()
A = []
(cur_l, cur_r) = skobki[0]
for (l, r) in skobki[1:]:
	if l <= cur_r < r:
		cur_r = r
	elif cur_r < l:
		A.append((cur_l, cur_r))
		(cur_l, cur_r) = (l, r)
A.append((cur_l, cur_r))
cur = 0
res = []
for x in range(1, m + 1):
	(l, r) = A[cur]
	if x < l or x > r:
		res.append(x)
	elif x == r:
		cur = min(cur + 1, len(A) - 1)
print(len(res))
for i in res:
	print(i, end=' ')


(n, m) = map(int, input().split())
x = [i for i in range(1, m + 1)]
x = set(x)
for j in range(n):
	(l, r) = map(int, input().split())
	y = [i for i in range(l, r + 1)]
	y = set(y)
	x -= y
x = list(x)
print(len(x))
print(*x)


(n, m) = map(int, input().split())
a = [True] * (m + 1)
for _ in range(n):
	(l, r) = map(int, input().split())
	for x in range(l, r + 1):
		a[x] = False
ans = [0] * m
dst = 0
for x in range(1, m + 1):
	if a[x]:
		ans[dst] = x
		dst += 1
ans = ans[:dst]
print(dst)
print(' '.join(map(str, ans)))


def main():
	(n, m) = map(int, input().split())
	l = [False, *[True] * m]
	for _ in range(n):
		(u, v) = map(int, input().split())
		l[u:v + 1] = [False] * (v - u + 1)
	print(sum(l))
	print(*[i for (i, f) in enumerate(l) if f])
main()


(n, m) = map(int, input().split())
a = [0] * m
for i in range(n):
	(l, r) = map(int, input().split())
	for j in range(l - 1, r):
		a[j] += 1
count = 0
ans = []
for i in range(len(a)):
	if a[i] == 0:
		count += 1
		ans.append(str(i + 1))
print(count)
print(' '.join(ans))


(n, m) = map(int, input().split())
a = [0] * m
k = []
for i in range(n):
	(x1, x2) = map(int, input().split())
	for j in range(x1 - 1, x2):
		a[j] = 1
for i in range(m):
	if a[i] == 0:
		k.append(i + 1)
print(len(k))
print(*k)


(n, m) = map(int, input().split())
a = []
for i in range(n):
	(l, r) = map(int, input().split())
	a.append((l, -1))
	a.append((r, 1))
a.append((m + 1, -1))
a.append((m + 1, 1))
cnt = 0
lst = 0
r = []
k = 0
x = {}
for el in a:
	x[el[0]] = x.get(el[0], 0) - el[1]
a = sorted([[kl, z] for (kl, z) in x.items()])
for (kl, zn) in a:
	if cnt == 0:
		for i in range(lst + 1, kl):
			r.append(i)
			k += 1
	lst = kl
	cnt += zn
print(k)
print(*r)


(a, b) = input().split()
a = int(a)
b = int(b)
l = []
for i in range(1, b + 1):
	l.append(i)
k = []
for i in range(a):
	(c, d) = input().split()
	c = int(c)
	d = int(d)
	for j in range(c, d + 1):
		k.append(j)
k = list(set(map(int, k)))
ans = []
for i in l:
	if i not in k:
		ans.append(i)
print(len(ans))
for j in range(len(ans)):
	print(ans[j], end=' ')


input_list = list(map(int, input().split()))
n = input_list[0]
m = input_list[1]
segment = [False] * (m + 1)
for i in range(n):
	seg = list(map(int, input().split()))
	for j in range(seg[0], seg[1] + 1):
		segment[j] = True
ans_count = 0
ans = ''
for (idx, point) in enumerate(segment):
	if idx == 0:
		continue
	elif point == True:
		continue
	else:
		if len(ans) != 0:
			ans = ans + ' '
		ans_count = ans_count + 1
		ans = ans + str(idx)
print(ans_count)
print(ans)


def main():
	limit = 105
	(n, m) = map(int, input().split())
	arr = [0] * limit
	for _ in range(n):
		(l, r) = map(int, input().split())
		for i in range(l - 1, r):
			arr[i] = 1
	results = []
	for i in range(m):
		if arr[i] == 0:
			results.append(i)
	if len(results) == 0:
		print(0)
		return
	print(len(results))
	for x in results:
		print(x + 1, end=' ')
main()


(n, m) = map(int, input().split())
l = []
for t in range(n):
	(a, b) = map(int, input().split())
	for i in range(a, b + 1):
		l.append(i)
print(m - len(set(l)))
for j in range(1, m + 1):
	if j not in l:
		print(j, end=' ')


(n, m) = map(int, input().split())
a = []
s = set()
for i in range(n):
	a.append(list(map(int, input().split())))
for i in range(n):
	for j in range(a[i][0], a[i][1] + 1):
		s.add(j)
print(m - len(s))
for i in range(1, m + 1):
	if i not in s:
		print(i, end=' ')


(n, m) = map(int, input().split())
liste = list(range(1, m + 1))
for i in range(n):
	(i, r) = map(int, input().split())
	for x in range(i, r + 1):
		if x in liste:
			liste.remove(x)
print(len(liste))
print(*liste)


(n, m) = map(int, input().strip().split())
points = [True for i in range(m + 1)]
for i in range(n):
	(a, b) = map(int, input().strip().split())
	for j in range(a, b + 1):
		points[j] = False
missed = [str(j) for j in range(1, m + 1) if points[j]]
print(len(missed))
if missed:
	print(' '.join(missed))


l = list(map(int, input().split()))
I = []
for i in range(l[0]):
	k = list(map(int, input().split()))
	I.append(k)

def segment(l):
	return [int(i) for i in range(l[0], l[1] + 1)]

def minimum_num(I):
	m = []
	for i in I:
		m.append(i[0])
	return min(m)

def count_absent_point(l, I):
	main = []
	count_absent = 0
	absent_num = []
	for i in I:
		for j in segment(i):
			main.append(j)
	Set = set(main)
	for i in range(1, l[1] + 1):
		if i not in Set:
			count_absent += 1
			absent_num.append(i)
	if count_absent != 0:
		print(count_absent)
		for i in absent_num:
			print(i, end=' ')
	else:
		print(0)
count_absent_point(l, I)


(n, m) = map(int, input().strip().split(' '))
List = [0] * (m + 1)
X = []
for _ in range(n):
	(a, b) = map(int, input().strip().split(' '))
	for i in range(a, b + 1):
		List[i] = 1
for i in range(1, len(List)):
	if List[i] == 0:
		X.append(i)
print(len(X))
print(*X)


params = input().split()
inputLimit = int(params[0])
numberLimit = int(params[1])
betweens = []
count = 0
numbers = []
for x in range(numberLimit):
	betweens.append({'number': x + 1, 'between': True})
for x in range(inputLimit):
	inp = input().split()
	l1 = int(inp[0])
	r1 = int(inp[1])
	for y in range(l1, r1 + 1):
		betweens[y - 1]['between'] = False
for x in range(numberLimit):
	if betweens[x]['between']:
		count = count + 1
		numbers.append(betweens[x]['number'])
print(count)
for x in range(numbers.__len__()):
	print(numbers[x], end=' ')


(n, m) = map(int, input().split())
s = list(range(1, m + 1))
for _ in range(n):
	(l, r) = map(int, input().split())
	for i in range(l, r + 1):
		try:
			s.remove(i)
		except:
			pass
print(len(s))
print(*s)


(n, m) = map(int, input().split())
s = set()
for i in range(0, n):
	(l, r) = map(int, input().split())
	for j in range(l, r + 1):
		s.add(j)
k = []
for i in range(1, m + 1):
	if not i in s:
		k.append(i)
print(len(k))
print(*k)


k = 0
points = []
(n, m) = map(int, input().split())
line = [1 for x in range(m + 1)]
for _ in range(n):
	(l, r) = list(map(int, input().split()))
	line[l:r + 1] = [0] * (r - l + 1)
for i in range(1, m + 1):
	if line[i] != 0:
		points.append(i)
		k += 1
print(k)
print(' '.join(map(str, points)))


def points(n, m, ls):
	l = []
	c = 0
	for i in range(1, m + 1):
		c1 = 0
		for j in range(n):
			if i >= ls[j][0] and i <= ls[j][1]:
				c1 = 1
				break
		if c1 == 0:
			c = c + 1
			l.append(i)
	if c == 0:
		print(0)
		print()
	else:
		print(c)
		print(' '.join(map(str, l)))
(n, m) = input().split()
n = int(n)
m = int(m)
ls = [[int(j) for j in input().split()] for i in range(n)]
points(n, m, ls)


def transform(x):
	return int(x)
(n, m) = tuple(map(transform, input().split()))
listaDeComparacao = list(range(1, m + 1, 1))
i = 0
inteiros = {}
numerosForaDoSegmento = []
while i < n:
	i += 1
	(l, r) = tuple(map(transform, input().split()))
	if l == r:
		inteiros[l] = l
	for num in list(range(l, r + 1, 1)):
		inteiros[num] = num
inteiros = sorted(list(inteiros.keys()))
for num in listaDeComparacao:
	if num not in inteiros:
		numerosForaDoSegmento.append(num)
tamanhoLista = len(numerosForaDoSegmento)
if tamanhoLista != 0:
	print(tamanhoLista)
	print(*numerosForaDoSegmento)
else:
	print(0)


import math
(n, m) = [int(x) for x in input().split()]
arr = []
for i in range(n):
	a = [int(x) for x in input().split()]
	arr.append(a)
ans = []
for i in range(1, m + 1):
	check = True
	for j in range(n):
		if arr[j][0] <= i <= arr[j][1]:
			check = False
	if check:
		ans.append(i)
print(len(ans))
print(*ans)


(a, b) = map(int, input().split())
k = []
for i in range(1, b + 1):
	k.append(i)
l = []
for i in range(a):
	(m, n) = map(int, input().split())
	for i in range(m, n + 1):
		l.append(i)
z = list(set(l))
o = []
for i in range(len(k)):
	if k[i] not in z:
		o.append(k[i])
print(len(o))
for i in o:
	print(i, end=' ')


(n, k) = map(int, input().split())
l = []
y = []
for i in range(n):
	(a, b) = map(int, input().split())
	for i in range(a, b + 1):
		l.append(i)
for i in range(1, k + 1):
	y.append(i)
y.sort()
y = set(y)
l.sort()
l = set(l)
u = y - l
u = list(u)
print(len(u))
print(' '.join(map(str, u)))


(n, m) = map(int, input().split())
lis = []
n1 = n
while n > 0:
	lis.append(list(map(int, input().split())))
	n -= 1
count = 0
ans = []
for i in range(1, m + 1):
	flag = 0
	for j in range(n1):
		if i > lis[j][0] and i < lis[j][1]:
			flag = 1
			break
		elif i == lis[j][0] or i == lis[j][1]:
			flag = 1
			break
	if flag == 0:
		count += 1
		ans.append(i)
print(count)
if count != 0:
	for i in ans:
		print(i, end=' ')


(n, m) = [int(x) for x in input().split()]
l = set([i for i in range(1, m + 1)])
for i in range(n):
	(a, b) = [int(x) for x in input().split()]
	l -= set([i for i in range(a, b + 1)])
print(len(l))
print(*l, sep=' ')


(n, m) = map(int, input().split())
ans = [0] * (m + 2)
for i in range(n):
	(a, b) = map(int, input().split())
	ans[a] += 1
	ans[b + 1] -= 1
for i in range(1, m + 2):
	ans[i] = ans[i] + ans[i - 1]
c = 0
ans1 = []
for i in range(1, m + 1):
	if ans[i] == 0:
		ans1.append(i)
print(len(ans1))
print(*ans1)


(n, m) = map(int, input().split())
ar = [[int(i) for i in input().split()] for j in range(n)]
cnt = 0
li = [i for i in range(1, m + 1)]
for i in range(1, m + 1):
	for j in range(n):
		if ar[j][0] <= i <= ar[j][1]:
			if li.count(i) != 0:
				li.remove(i)
print(len(li))
print(*li)


(q, n) = map(int, input().split())
arr = [1] * n
for i in range(q):
	(l, r) = map(int, input().split())
	for j in range(l - 1, r):
		arr[j] = 0
if sum(arr) == 0:
	print(0)
else:
	print(sum(arr))
	for i in range(n):
		if arr[i] == 1:
			print(i + 1, end=' ')


(m, n) = map(int, input().split())
l = []
l1 = []
for i in range(1, n + 1):
	l.append(i)
for _ in range(m):
	(a, b) = map(int, input().split())
	l1.append((a, b))
for i in l1:
	for j in range(i[0], i[1] + 1):
		if j in l:
			l.remove(j)
if l == []:
	print(0)
else:
	print(len(l))
	print(' '.join(map(str, l)))


l1 = list(map(int, input().split()))
n = l1[0]
m = l1[1]
s = set()
for i in range(n):
	l1 = list(map(int, input().split()))
	s = s.union(set(range(l1[0], l1[1] + 1)))
print(m - len(s))
s1 = set(range(1, m + 1))
l = list(map(str, s1 - s))
print(' '.join(l))


(a, b) = map(int, input().split())
lst = []
lst1 = []
sum = 1
for i in range(a):
	(c, d) = map(int, input().split())
	for j in range(c, d + 1):
		lst.append(j)
lst = list(set(lst))
for j in range(1, b + 1):
	lst1.append(j)
print(len(lst1) - len(lst))
for k in range(len(lst1)):
	if lst1[k] in lst:
		continue
	else:
		print(lst1[k], end=' ')


def points_in_sigments(sigment, point):
	points = []
	sigments_list = []
	total_list = []
	for _value in range(sigment):
		sigments_list.append(list(map(int, input().split())))
	for value in range(1, point + 1):
		for value2 in sigments_list:
			for i in range(value2[0], value2[1] + 1):
				if value == i:
					points.append(value)
	for number in range(1, m + 1):
		if number not in points:
			total_list.append(number)
	print(len(total_list))
	print(*total_list)
(n, m) = map(int, input().split())
points_in_sigments(n, m)


a = [0] * 110
(n, m) = map(int, input().split())
for i in range(0, n):
	(l, r) = map(int, input().split())
	for temp in range(l, r + 1):
		a[temp] = 1
cnt = 0
for i in range(1, m + 1):
	if a[i] == 0:
		cnt += 1
print(cnt)
for i in range(1, m + 1):
	if a[i] == 0:
		print(i, end=' ')
print()


(n, m) = map(int, input().split())
a = set()
for i in range(n):
	(x, y) = map(int, input().split())
	for i in range(x, y + 1):
		a.add(i)
res = []
cnt = 0
for i in range(1, m + 1):
	if i not in a:
		res.append(i)
		cnt += 1
print(cnt)
print(*res)


(n, m) = map(int, input().split())
used = [-1] * (m + 1)
for _ in range(n):
	(l, r) = map(int, input().split())
	for i in range(l, r + 1):
		used[i] = 1
ans = []
count = 0
for i in range(1, m + 1):
	if used[i] == -1:
		count += 1
		ans.append(str(i))
print(len(ans))
print(' '.join(ans))


(n, m) = [int(x) for x in input().split()]
p = []
for i in range(n):
	(l, r) = [int(x) for x in input().split()]
	for x in range(l, r + 1):
		if x not in p:
			p.append(x)
print(m - len(p))
for j in range(1, m + 1):
	if j not in p:
		print(j, end=' ')


(n, m) = [int(x) for x in input().split()]
g = set([i for i in range(1, m + 1)])
p = set([])
for _ in range(n):
	(a, b) = [int(x) for x in input().split()]
	h = set([i for i in range(a, b + 1)])
	p = p | h
g = g ^ p
print(len(g))
if len(g) > 0:
	t = sorted(g)
	for i in t:
		print(i, end=' ')


(n, m) = map(int, input().split())
arr = [False] * (m + 1)
for _ in range(n):
	(l, r) = map(int, input().split())
	for i in range(l, r + 1):
		arr[i] = True
miss = []
count = 0
for b in range(1, m + 1):
	if not arr[b]:
		count += 1
		miss.append(b)
print(count)
print(*miss)


a = input().split()
b = int(a[0])
c = int(a[1])
i = 1
lst = []
j = 0
lst = []
lst1 = []
lst3 = []
while i <= c:
	lst.append(i)
	i = i + 1
for j in range(b):
	v = input().split()
	x = int(v[0])
	y = int(v[1])
	while x <= y:
		lst1.append(x)
		x = x + 1
lst2 = sorted(lst1)
for j in lst:
	if j not in lst2:
		lst3.append(j)
r = len(lst3)
if r == 0:
	print('0')
	print(' ')
else:
	print(r)
	for k in lst3:
		print(k, end=' ')


(n, m) = map(int, input().split())
arr = []
for i in range(n):
	arr.append(list(map(int, input().split())))
a1 = []
for i in range(1, m + 1):
	x = 0
	for j in range(n):
		if i >= arr[j][0] and i <= arr[j][1]:
			x = 1
			break
	if x == 0:
		a1.append(i)
print(len(a1))
print(*a1)


(n, m) = map(int, input().split())
points = [True for i in range(m + 1)]
for i in range(n):
	(a, b) = map(int, input().split())
	for j in range(a, b + 1):
		points[j] = False
ans1 = 0
ans2 = ''
for i in range(1, m + 1):
	if points[i]:
		ans1 += 1
		ans2 += str(i) + ' '
print(ans1)
print(ans2)


(q, n) = map(int, input().split())
l = [0] * n
for _ in range(q):
	(le, r) = map(int, input().split())
	le = le - 1
	r = r - 1
	l[le] += 1
	if r < n - 1:
		l[r + 1] -= 1
for i in range(1, n):
	l[i] += l[i - 1]
print(l.count(0))
m = []
for i in range(n):
	if l[i] == 0:
		m.append(i + 1)
print(*m)


def uncommon(m, lst):
	w = list()
	for elem in range(1, m + 1):
		for elem1 in lst:
			if elem in elem1:
				w.append(elem)
	return (len(set(range(1, m + 1)) - set(w)), set(range(1, m + 1)) - set(w))
(n, m) = [int(i) for i in input().split()]
z = list()
for i in range(n):
	(a, b) = [int(j) for j in input().split()]
	if a == b:
		z.append([a])
	else:
		z.append(list(range(a, b + 1)))
print(uncommon(m, z)[0])
print(*uncommon(m, z)[1])


(x, y) = [int(a) for a in input().split()]
d = []
o = []
for i in range(x):
	(a, b) = [int(j) for j in input().split()]
	for j in range(a, b + 1):
		d.append(j)
d = sorted(d)
e = set(d)
for i in range(1, y + 1):
	if i not in e:
		o.append(i)
if len(o) == 0:
	print(0)
	quit()
print(len(o))
for i in o:
	print(i, end=' ')


i = lambda : map(int, input().split())
d = lambda x, y: {*range(x, y + 1)}
(n, m) = i()
a = d(1, m)
for _ in '0' * n:
	a -= d(*i())
print(len(a))
print(*a)


(n, m) = map(int, input().split())
arr = [0] * (m + 2)
for i in range(n):
	(a, b) = map(int, input().split())
	arr[a] += 1
	arr[b + 1] -= 1
count = 0
brr = []
for i in range(1, len(arr) - 1):
	count += arr[i]
	if count == 0:
		brr.append(i)
if len(brr) == 0:
	print(0)
else:
	print(len(brr))
	print(*brr)


(n, m) = [int(x) for x in str(input()).split(' ', 1)]
l = []
r = []
s = [1 for _ in range(m + 1)]
s[0] = 0
for _ in range(n):
	(lx, rx) = [int(x) for x in str(input()).split(' ', 1)]
	for i in range(lx, rx + 1):
		s[i] = 0
print(sum(s))
if sum(s):
	print(' '.join((str(i) for i in range(1, m + 1) if s[i])))


(n, m) = [int(i) for i in input().strip().split(' ')]
all_pts = {}
for i in range(m):
	all_pts[i + 1] = i + 1
for i in range(n):
	(l, r) = [int(i) for i in input().strip().split(' ')]
	for j in range(l, r + 1):
		if j in all_pts:
			del all_pts[j]
if len(all_pts) == 0:
	print(0)
else:
	print(len(all_pts))
	for i in all_pts:
		print(all_pts[i], end=' ')
print('')


d = {}
(n, m) = map(int, input().split())
for i in range(1, m + 1):
	d.update({i: 0})
for i in range(n):
	(l, r) = map(int, input().split())
	for j in range(l, r + 1):
		d[j] += 1
temp = []
for i in range(1, m + 1):
	if d[i] == 0:
		temp.append(i)
print(len(temp))
if len(temp) > 0:
	for i in temp:
		print(i, end=' ')
	print()


(n, m) = [int(x) for x in input().split()]
arr = [True] * (m + 1)
for _ in range(n):
	(a, b) = [int(x) for x in input().split()]
	for i in range(a, b + 1):
		arr[i] = False
res = []
for i in range(1, m + 1):
	if arr[i]:
		res.append(i)
print(len(res))
print(*res)


(n, m) = map(int, input().split())
a = []
b = []
k = True
for i in range(n):
	a.append(list(map(int, input().split())))
a.sort(key=lambda x: (x[1], x[0]))
for i in range(1, m + 1):
	for j in a:
		if j[0] <= i <= j[1]:
			k = False
			break
	if k == True:
		b.append(i)
	k = True
if len(b) == 0:
	print(0)
else:
	print(len(b))
	print(*b)


(n, m) = [int(i) for i in input().split()]
arr = []
for i in range(n):
	(a, b) = [int(i) for i in input().split()]
	temp = [int(i) for i in range(a, b + 1)]
	for x in range(len(temp)):
		arr.append(temp[x])
arr1 = [int(i) for i in range(1, m + 1)]
not_pres = []
count = 0
for j in range(m):
	pres = 0
	for i in range(len(arr)):
		if arr1[j] == arr[i]:
			pres = 1
			break
	if pres == 0:
		not_pres.append(arr1[j])
		count += 1
print(count)
for i in range(count):
	print(not_pres[i], end=' ')


(m, n) = map(int, input().split())
g = []
s = []
en = []
be = []
for i in range(m):
	k = list(map(int, input().split()))
	g.append(k)
for i in range(len(g)):
	q = g[i][0]
	y = g[i][1]
	a = max(q, y)
	b = min(q, y)
	for nm in range(0, a + 1):
		if nm >= b and nm <= a:
			s.append(nm)
s.sort()
for z in range(1, n + 1):
	en.append(z)
for x in range(len(en)):
	if en[x] not in s:
		be.append(en[x])
iq = list(map(str, be))
eq = ' '.join(iq)
if len(be) == 0:
	print('0')
else:
	print(len(be))
	print(eq)


config = input()
config_splitted = config.split(' ')
num_segments = int(config_splitted[0])
upper_bound = int(config_splitted[1])
axis = [0] * 110
i = 0
for i in range(num_segments):
	segment = input()
	l = int(segment.split(' ')[0])
	r = int(segment.split(' ')[1])
	j = l
	while j <= r:
		axis[j] = 1
		j = j + 1
num_not_in_segment = 0
not_in_segment = []
i = 1
while i <= upper_bound:
	if axis[i] == 0:
		num_not_in_segment = num_not_in_segment + 1
		not_in_segment.append(i)
	i = i + 1
print(str(num_not_in_segment))
if num_not_in_segment > 0:
	num = 0
	for num in range(len(not_in_segment)):
		if num == len(not_in_segment) - 1:
			print(str(not_in_segment[num]))
		else:
			print(str(not_in_segment[num]), end=' ')


(n, m) = map(int, input().split())
seg = []
check = []
result = []
for i in range(n):
	(l, r) = map(int, input().split())
	for j in range(l, r + 1):
		seg.append(j)
seg = set(seg)
for i in range(1, m + 1):
	check.append(i)
for i in range(m):
	if check[i] not in seg:
		result.append(check[i])
result.sort()
print(len(result))
for i in range(len(result)):
	print(result[i], end=' ')


(n, m) = map(int, input().split())
arr = []
for i in range(n):
	(l, r) = map(int, input().split())
	arr.append([l, r])
c = 0
ans = []
for i in range(1, m + 1):
	f = 0
	for j in range(len(arr)):
		if i >= arr[j][0] and i <= arr[j][1]:
			f = 1
			break
	if f == 0:
		c += 1
		ans.append(i)
print(c)
for i in ans:
	print(i, end=' ')
print()


from functools import reduce
(n, m) = map(int, input().split())
vis = [False] * m
for _ in range(n):
	(a, b) = map(int, input().split())
	for x in range(a - 1, b):
		vis[x] = True
ans = len(list(filter(lambda x: not x, vis)))
print(ans)
for (idx, x) in enumerate(vis):
	if not x:
		print(idx + 1, end=' ')
print()


from collections import Counter
(n, m) = map(int, input().split())
segments = Counter()
for _ in range(n):
	(l, r) = map(int, input().split())
	for i in range(l, r + 1):
		if i in segments:
			segments[i] += 1
		else:
			segments[i] = 1
print(m - len(segments))
print(' '.join([str(i) for i in range(1, m + 1) if i not in segments.keys()]))


t = 1
for test in range(1, t + 1):
	(n, m) = map(int, input().split())
	ans = []
	count = 0
	D = {}
	for i in range(n):
		(l, r) = map(int, input().split())
		for j in range(l, r + 1):
			D[j] = 1
	for i in range(1, m + 1):
		if i not in D:
			count += 1
			ans.append(i)
	print(count)
	print(*ans)


s = input().split(' ')
(n, m) = (int(s[0]), int(s[1]))
visit = [0 for i in range(m + 1)]
for i in range(n):
	s = input().split(' ')
	(l, r) = (int(s[0]), int(s[1]))
	for i in range(l, r + 1):
		visit[i] = 1
res = []
for i in range(1, m + 1):
	if visit[i] == 0:
		res.append(i)
print(len(res))
for i in res:
	print(i, end=' ')


(n, m) = map(int, input().split())
ns = set([i for i in range(1, m + 1)])
for i in range(n):
	(l, r) = map(int, input().split())
	for k in range(l, r + 1):
		if k in ns:
			ns.remove(k)
print(len(ns))
if len(ns) > 0:
	print(*list(ns))


def solution(m, segments):
	points = list(range(1, m + 1))
	for i in range(0, len(segments)):
		seg1 = segments[i][0]
		seg2 = segments[i][1] + 1
		seg = list(range(seg1, seg2))
		same = list(set(seg) & set(points))
		for j in range(len(same)):
			points.remove(same[j])
	return points

def main():
	segments = []
	(n, m) = map(int, input().split())
	for i in range(0, n):
		segment = list(map(int, input().split()))
		segments.append(segment)
	result = solution(m, segments)
	l = len(result)
	print(l)
	if l != 0:
		ans = ' '.join(map(str, result))
		print(ans)
	return result
main()


(n, m) = map(int, input().split())
arr = list()
res = list()
for i in range(n):
	(a, b) = map(int, input().split())
	arr += [int(i) for i in range(a, b + 1)]
for y in range(1, m + 1):
	if y not in arr:
		res.append(y)
print(len(res))
[print(i, end=' ') for i in res]


(n, m) = map(int, input().split())
ta = [0] * (m + 2)
for i in range(n):
	(l, r) = map(int, input().split())
	ta[l] += 1
	ta[r + 1] -= 1
ans = []
c = 0
for (i, x) in enumerate(ta[1:-1]):
	c += x
	if c == 0:
		ans.append(i + 1)
print(len(ans))
print(*ans)


from sys import stdin, stdout
(n, m) = [int(x) for x in stdin.readline().rstrip().split()]
recta = set()
for i in range(n):
	(l, r) = [int(x) for x in stdin.readline().rstrip().split()]
	for j in range(l, r + 1):
		if j not in recta:
			recta.add(j)
ans = set(range(1, m + 1))
ans -= recta
if len(ans) == 0:
	stdout.write('0\n')
else:
	stdout.write(str(len(ans)) + '\n')
	print(*ans)


l = list(map(int, input().split()))
w = {}
for d in range(1, l[1] + 1):
	w[d] = 1
for i in range(l[0]):
	a = list(map(int, input().split()))
	for i in range(a[0], a[1] + 1):
		if i in w.keys():
			w[i] = 0
ans = []
for i in w.keys():
	if w[i] != 0:
		ans.append(i)
print(len(ans))
print(' '.join([str(i) for i in ans]))


(n, m) = map(int, input().split())
l = []
l1 = []
for i in range(1, m + 1):
	l.append(i)
for i in range(n):
	(a, b) = map(int, input().split())
	if a != b:
		for j in range(a, b + 1):
			l1.append(j)
	if a == b:
		l1.append(a)
l2 = list(set(l) ^ set(l1))
print(len(l2))
for i in l2:
	print(i, end=' ')


(n, m) = map(int, input().split())
a = [0] * (m + 1)
for i in range(n):
	(l, r) = map(int, input().split())
	a[l - 1] = a[l - 1] + 1
	a[r] = a[r] - 1
cnt = tmp = 0
ans = [0] * m
for i in range(m):
	tmp = tmp + a[i]
	if tmp == 0:
		cnt = cnt + 1
		ans[i] = 1
print(cnt)
for i in range(m):
	if ans[i] != 0:
		print(i + 1, end=' ')


(n, m) = map(int, input().split())
ans = []
yo = []
for i in range(n):
	(a, b) = map(int, input().split())
	yo.append([a, b])
for i in range(1, m + 1):
	flag = 0
	for (a, b) in yo:
		if a <= i <= b:
			flag = 1
			break
	if not flag:
		ans.append(i)
print(len(ans))
print(*ans)


(n, m) = map(int, input().split())
d = [0] * (m + 1)
d[0] = 1
(ans, c) = ([], 0)
for i in range(n):
	(l, r) = map(int, input().split())
	if l == r:
		d[r] = 1
	else:
		for i in range(l, r + 1):
			d[i] = 1
for (i, v) in enumerate(d):
	if v == 0:
		ans.append(i)
		c += 1
print(c)
print(*ans)


(n, m) = [int(x) for x in input().split()]
arr = [True] * m
for i in range(n):
	(l, r) = [int(x) for x in input().split()]
	for j in range(l - 1, r):
		arr[j] = False
print(arr.count(True))
for (i, val) in enumerate(arr):
	if val:
		print(i + 1, end=' ')


import sys
input = lambda : sys.stdin.readline().strip('\r\n')
(n, m) = map(int, input().split())
ls = [i + 1 for i in range(m)]
for _ in range(n):
	(l, r) = map(int, input().split())
	l -= 1
	r -= 1
	for i in range(l, r + 1):
		ls[i] = 0
ans = 0
res = []
for i in ls:
	if i != 0:
		ans += 1
		res.append(i)
print(ans)
print(*res)


i = input().split(' ')

def removeSegments(available, used):
	for segment in used:
		if segment in available:
			available.remove(segment)
	return available
available = list(range(1, int(i[1]) + 1))
used = set()
for i in range(int(i[0])):
	segment = input().split(' ')
	for e in range(int(segment[0]), int(segment[1]) + 1):
		used.add(e)
result = removeSegments(available, used)
print(len(result))
for i in result:
	print(i, end=' ')


(n, m) = input().split(' ')
(n, m) = (int(n), int(m))
mass = []
for i in range(0, n):
	(a, b) = input().split(' ')
	mass.append(list(range(int(a), int(b) + 1)))
mass = sum(mass, [])
answer = []
for i in range(1, m + 1):
	if i not in mass:
		answer.append(i)
print(len(answer))
print(str(answer)[1:-1].replace(',', ''))


(n, m) = tuple(map(int, input().split()))
q = [1] * m
for i in range(n):
	w = tuple(map(int, input().split()))
	d = w[0]
	f = w[1]
	for i in range(d - 1, f):
		q[i] = 0
z = list(filter(lambda j: j == 1, q))
print(len(z))
for i in range(m):
	if q[i] == 1:
		print(i + 1, end=' ')


(n, m) = map(int, input().split())
a = [i + 1 for i in range(m)]
t = [0] * m
x = m
for i in range(n):
	(l, b) = map(int, input().split())
	for j in range(l - 1, b):
		t[j] = 1
print(t.count(0))
for i in range(m):
	if t[i] == 0:
		print(i + 1, end=' ')


(n, m) = map(int, input().split())
ar = [0] * m
for i in range(n):
	(a, b) = map(int, input().split())
	for e in range(a - 1, b):
		ar[e] = 1
ans = []
for i in range(m):
	if ar[i] == 0:
		ans.append(i + 1)
print(len(ans))
print(*ans)


(n, m) = map(int, input().split())
flag = [True] * m
for i in range(n):
	(a, b) = map(int, input().split())
	a -= 1
	b -= 1
	for i in range(a, b + 1):
		flag[i] = False
print(flag.count(True))
print(*[i + 1 for i in range(m) if flag[i]])


(n, m) = map(int, input().split())
arr = [0] * (m + 2)
for i in range(n):
	(l, r) = map(int, input().split())
	arr[l] += 1
	arr[r + 1] -= 1
for i in range(1, m + 1):
	arr[i] += arr[i - 1]
res = list()
for i in range(1, m + 1):
	if arr[i] == 0:
		res.append(i)
print(len(res))
print(*res)


(n, m) = map(int, input().split())
Ox = [_ for _ in range(1, m + 1)]
for i in range(n):
	(l, r) = map(int, input().split())
	for j in range(l, r + 1):
		if j in Ox:
			Ox.remove(j)
print(len(Ox))
if Ox:
	print(' '.join(map(str, Ox)))


(n, m) = map(int, input().split())
a = []
s = [i for i in range(1, m + 1)]
for i in range(n):
	(l, r) = map(int, input().split())
	for i in range(l, r + 1):
		a.append(i)
set(a)
z = []
for x in s:
	if x not in a:
		z.append(x)
print(len(z))
print(' '.join((str(x) for x in z)))


(n, m) = map(int, input().split())
x = [1] * m
for i in range(n):
	(a, b) = map(int, input().split())
	for i in range(a, b + 1):
		x[i - 1] = 0
print(sum(x))
print(' '.join([str(i + 1) for i in range(m) if x[i]]))


from sys import stdin, stdout

def rint():
	return map(int, stdin.readline().split())
(n, m) = rint()
ans = [0] * (m + 1)
ans[0] = 1
for i in range(n):
	(r, l) = rint()
	for j in range(r, l + 1):
		ans[j] = 1
ans2 = []
for i in range(1, m + 1):
	if ans[i] == 0:
		ans2.append(i)
if len(ans2):
	print(len(ans2))
	print(*ans2)
else:
	print(0)


(n, m) = map(int, input().split())
s = set(range(1, m + 1))
for i in range(n):
	(l, r) = map(int, input().split())
	for j in range(l, r + 1):
		s.discard(j)
print(len(s))
print(' '.join(map(str, list(s))))


data = []
exclude = []
count = 0
(n, m) = map(int, input().split())
for i in range(n):
	(l, r) = map(int, input().split())
	data.append((l, r))
belongs = [False for i in range(1, m + 2)]
for i in range(1, m + 1):
	for elem in data:
		if elem[0] <= i <= elem[1]:
			if not belongs[i]:
				belongs[i] = True
for i in range(1, len(belongs)):
	if belongs[i] == False:
		count += 1
if count > 0:
	print(count)
	for (idx, value) in enumerate(belongs):
		if idx > 0:
			if value == False:
				print(idx, end=' ')
else:
	print(0)


(n, m) = input().split()
n = int(n)
m = int(m)
l = []
temp = []
store = []
for i in range(1, m + 1):
	store.append(i)
for i in range(0, n):
	(a, b) = input().split()
	a = int(a)
	b = int(b)
	temp.append(a)
	temp.append(b)
	l.append(temp)
	for j in range(a, b + 1):
		if j in store:
			store.remove(j)
	temp = []
print(len(store))
for i in store:
	print(i, end=' ')


(n, m) = map(int, input().split())
segments = []
for i in range(n):
	(l, r) = map(int, input().split())
	segments.append([l, r])

def check(i):
	for j in segments:
		if j[0] <= i and i <= j[1]:
			return False
	return True
points = []
counter = 0
for i in range(1, m + 1):
	if check(i):
		counter += 1
		points.append(i)
print(counter)
print(*points)


(n, m) = map(int, input().split())
lis = []
for inp in range(n):
	(l, r) = map(int, input().split())
	for i in range(l, r + 1):
		lis.append(i)
p = set(lis)
miss = []
for j in range(1, m + 1):
	if j not in p:
		miss.append(j)
print(len(miss))
print(' '.join([str(x) for x in miss]))


pt = list(map(int, input().split()))
p = pt[0]
t = pt[1]
l = []
for i in range(p):
	sq = list(map(int, input().split()))
	s = sq[0]
	q = sq[1]
	if s == q:
		l.append(s)
	else:
		for i in range(s, q + 1):
			l.append(i)
p = []
for j in range(1, t + 1):
	if j not in l:
		p.append(j)
print(len(p))
if len(p) != 0:
	for i in p:
		print(i, end=' ')


(n, m) = map(int, input().split())
k = []
for i in range(n):
	k.append(tuple(map(int, input().split())))
ntg = []
c = 0
for i in range(1, m + 1):
	if any((j[0] <= i <= j[1] for j in k)):
		continue
	else:
		c += 1
		ntg.append(i)
if c != 0:
	print(c)
	print(*ntg)
else:
	print(0)


(n, m) = map(int, input().split())
count = [0] * m
points = 0
for x in range(1, n + 1):
	(a, b) = map(int, input().split())
	for i in range(1, m + 1):
		if a < i < b:
			count[i - 1] += 1
		elif a > i > b:
			count[i - 1] += 1
		elif a == i or i == b:
			count[i - 1] += 1
print(count.count(0))
for j in range(m):
	if count[j] == 0:
		print(j + 1, end=' ')


def mark(points, start, end):
	for i in range(start, end):
		points[i] = True
(segments, m) = map(int, input().split())
points = [False for i in range(m)]
for i in range(segments):
	(start, end) = map(int, input().split())
	mark(points, start - 1, end)
k = 0
kpoints = []
for i in range(len(points)):
	if points[i] == False:
		k += 1
		kpoints.append(str(i + 1))
if k > 0:
	print(k)
	print(' '.join(kpoints))
else:
	print(0)


(n, m) = map(int, input().split())
k = 0
x = []
y = []
for i in range(n):
	(l, r) = map(int, input().split())
	x.append([l, 1])
	x.append([r, -1])
x.sort(key=lambda l: (l[0], -l[1]))
j = 0
for i in range(1, m + 1):
	g = 0
	while j < 2 * n and x[j][0] == i:
		g = 1
		if x[j][1] == 1:
			k += 1
		elif x[j][1] == -1:
			k -= 1
		j += 1
	if g == 0:
		if k == 0:
			y.append(i)
print(len(y))
print(*y)


(n, m) = [int(x) for x in input().split()]
ret = []
for i in range(m):
	ret.append(i + 1)
while n:
	n = n - 1
	(l, r) = [int(x) for x in input().split()]
	while l <= r:
		for i in range(len(ret)):
			if ret[i] == l:
				ret.remove(l)
				break
		l = l + 1
print(len(ret))
for i in ret:
	print(i, end=' ')


import sys
r = lambda : sys.stdin.readline()
(n, m) = map(int, r().split())
d = []
d2 = []
ddd = []
for a in range(1, m + 1):
	d = d + [a]
for a in range(n):
	(i, j) = map(int, r().split())
	for b in range(i, j + 1):
		d2 = d2 + [b]
d2 = list(set(d2))
for a in range(len(d)):
	cc = 0
	for b in range(len(d2)):
		if d[a] == d2[b]:
			cc = 1
	if cc == 0:
		ddd = ddd + [d[a]]
print(len(ddd))
c2 = ''
for a in range(len(ddd)):
	if a == len(ddd):
		sys.stdout.write(str(ddd[a]))
	else:
		sys.stdout.write(str(ddd[a]) + ' ')


(n, m) = map(int, input().split())
a = [False] * m
for i in range(n):
	(k, b) = map(int, input().split())
	k -= 1
	b -= 1
	for j in range(k, b + 1):
		a[j] = True
ans = 0
ansl = []
for i in range(m):
	if not a[i]:
		ans += 1
		ansl.append(i + 1)
print(ans)
print(*ansl)


R = lambda : map(int, input().split())
(n, k) = R()
l = [False] * k
for _ in range(n):
	(a, b) = R()
	for i in range(a - 1, b):
		l[i] = True
print(l.count(False))
for i in range(k):
	if not l[i]:
		print(i + 1, end=' ')


(n, m) = map(int, input().split())
a = [True] * (m + 1)
for i in range(n):
	(l, r) = map(int, input().split())
	for j in range(l, r + 1):
		a[j] = False
path = []
for i in range(1, m + 1):
	if a[i]:
		path.append(i)
print(len(path))
print(*path)


(nbSegments, maximum) = map(int, input().split())
segment = [1 for i in range(maximum)]
for i in range(nbSegments):
	(debut, fin) = map(int, input().split())
	for j in range(debut - 1, fin):
		segment[j] = 0
print(sum((segment[i] for i in range(maximum))))
for i in range(maximum):
	if segment[i] == 1:
		print(i + 1, end=' ')


(n, m) = map(int, input().split())
d = {}
for i in range(1, m + 1):
	d[i] = False
for i in range(n):
	(a, b) = map(int, input().split())
	for j in range(a, b + 1):
		d[j] = True
l = []
for i in range(1, m + 1):
	if d[i] == False:
		l.append(i)
print(len(l))
print(*l)


(n, m) = map(int, input().split())
dots = list(range(m + 1))
for i in range(n):
	(a, b) = map(int, input().split())
	for j in range(a, b + 1):
		dots[j] = 0
k = 0
mas = []
for i in dots:
	if i != 0:
		k += 1
		mas.append(i)
print(k)
for i in mas:
	print(i, end=' ')


def sint():
	return int(input())

def sints():
	return map(int, input().split())

def sara():
	return list(map(int, input().split()))

def sstr():
	s = input()
	return list(s[:len(s)])

def main():
	vis = [0] * 102
	(n, m) = sints()
	lst = []
	for i in range(n):
		(x, y) = sints()
		t = (x, y)
		lst.append(t)
	lst.sort()
	cnt = 0
	for i in lst:
		(x, y) = i
		if not vis[x]:
			while not vis[x] and x <= y:
				vis[x] = 1
				x += 1
				cnt += 1
		elif not vis[y]:
			while not vis[y] and y >= x:
				vis[y] = 1
				y -= 1
				cnt += 1
	print(m - cnt)
	for i in range(1, m + 1):
		if not vis[i]:
			print(i, end=' ')
	print('')
main()


(n, k) = input().split()
(n, k) = (int(n), int(k))
ls = list()
for i in range(1, n + 1):
	(x, y) = input().split()
	(x, y) = (int(x), int(y))
	for v in range(x, y + 1):
		if v not in ls:
			ls.append(v)
ls.sort()
ps = list()
for g in range(1, k + 1):
	if g not in ls:
		ps.append(g)
print(len(ps))
print(*ps)


(n, m) = map(int, input().split())
l = []
for _ in range(n):
	l.append(list(map(int, input().split())))
a = set(range(1, m + 1))
for i in range(n):
	a = a - set(range(l[i][0], l[i][1] + 1))
print(len(a))
for i in a:
	print(i, end=' ')


(n, m) = map(int, input().split())
l1 = []
l2 = []
for i in range(n):
	l1.append([int(x) for x in input().split()])
l1.sort()
if [1, m] in l1:
	print(0)
else:
	for i in range(1, m + 1):
		l2.append(i)
	for item in l1:
		for x in range(len(l2)):
			if l2[x] in range(item[0], item[1] + 1):
				l2[x] = -1
	p = l2.count(-1)
	for i in range(p):
		l2.remove(-1)
	print(len(l2))
	for item in l2:
		print(item, end=' ')


x = [int(x) for x in input().split()]
n = x[0]
m = x[1]
p = []
q = []
for i in range(n):
	y = [int(x) for x in input().split()]
	q.append(y)
for i in range(1, m + 1):
	p.append(i)
for i in range(n):
	for k in range(q[i][0], q[i][1] + 1):
		if k in p:
			p.remove(k)
print(len(p))
for i in p:
	print(i, end=' ')


(n, m) = [int(i) for i in input().split()]
arr = [0] * (m + 2)
for _ in range(n):
	(l, r) = [int(i) for i in input().split()]
	arr[l] += 1
	arr[r + 1] -= 1
ans = []
for i in range(1, m + 1):
	arr[i] += arr[i - 1]
	if arr[i] == 0:
		ans.append(i)
print(len(ans))
if len(ans):
	print(' '.join([str(i) for i in ans]))


st = input()
n = int(st.split()[0])
m = int(st.split()[1])
a = [0] * n
Ox = [0] * (m + 1)
for i in range(n):
	a[i] = [0] * 2
	st = input()
	a[i][0] = int(st.split()[0])
	a[i][1] = int(st.split()[1])
for i in range(n):
	l = a[i][0]
	r = a[i][1]
	if r == l:
		Ox[r] = 1
	else:
		for x in range(l, r + 1):
			Ox[x] = 1
answer = []
count = 0
for i in range(1, m + 1):
	if Ox[i] == 0:
		count = count + 1
		answer.append(i)
print(count)
for i in range(count):
	print(answer[i], end=' ')


entrada = str(input())
entrada = [int(x) for x in entrada.split()]
n = entrada[0]
m = entrada[1]
ans = [i for i in range(m)]
for i in range(n):
	entrada1 = str(input())
	entrada1 = [int(x) for x in entrada1.split()]
	l = entrada1[0]
	r = entrada1[1]
	for j in range(l - 1, r):
		ans[j] = -1
ans = [str(x + 1) for x in ans if x != -1]
print(len(ans))
print(' '.join(ans))


import sys
from math import *

def minp():
	return sys.stdin.readline().strip()

def mint():
	return int(minp())

def mints():
	return map(int, minp().split())
(n, m) = mints()
l = []
for i in range(n):
	l.append(tuple(mints()))
r = []
for i in range(1, m + 1):
	r.append(i)
	for j in l:
		if j[0] <= i and i <= j[1]:
			r.pop()
			break
print(len(r))
print(*r)


(number, upper) = map(int, input().split())
lup = list(range(1, upper + 1))
for i in range(number):
	(left, right) = map(int, input().split())
	for j in range(1, upper + 1):
		if j in range(left, right) or j == left or j == right:
			if j in lup:
				lup.remove(j)
print(len(lup))
for y in lup:
	print(y, end=' ')


(n, m) = [int(x) for x in input().split()]
p = set()
k = 0
kp = set()
for i in range(n):
	(l, r) = [int(x) for x in input().split()]
	for j in range(l, r + 1):
		p.add(j)
for i in range(1, m + 1):
	if not i in p:
		k += 1
		kp.add(i)
print(k)
for i in kp:
	print(i, end=' ')


(n, m) = map(int, input().split())
final = []
for _ in range(n):
	(a, b) = map(int, input().split())
	li = [x for x in range(a, b + 1)]
	for i in li:
		final.append(i)
final2 = [x for x in range(1, m + 1)]
final = set(final)
final2 = set(final2)
ans = final2.difference(final)
print(len(ans))
print(*ans)


(n, m) = map(int, input().split())
s = []
for i in range(1, m + 1):
	s.append(i)
for i in range(n):
	(l, r) = map(int, input().split())
	for j in range(l, r + 1):
		if j in s:
			s.pop(s.index(j))
print(len(s))
if len(s) > 0:
	for i in s:
		print(i, end=' ')


a = list(map(int, input().split()))
(b, c, m) = ([], [], [])
for j in range(a[0]):
	b.append(list(map(int, input().split())))
	for x in range(b[j][0], b[j][1] + 1):
		c.append(x)
d = list(set(c))
for x in range(1, a[1] + 1):
	if x in d:
		pass
	else:
		m.append(x)
print(len(m))
for x in range(len(m)):
	print(m[x], end=' ')


(ks, xs) = map(int, input().split(' '))
lss = ''
list_lss = []
for i in range(ks):
	(l, g) = map(int, input().split(' '))
	for j in range(l, g + 1):
		list_lss.append(j)
x = []
for j in range(1, xs + 1):
	x.append(j)
sums = 0
lsss = []
s = ''
for i in range(len(x)):
	xss = x[i]
	if xss in list_lss:
		lsss.append(xss)
	else:
		sums += 1
		s = s + str(x[i]) + str(' ')
if sums == 0:
	print('0')
elif sums > 0:
	print(sums)
	print(s)


(n, m) = map(int, input().split())
p = [True] * (m + 1)
while n != 0:
	(l, r) = map(int, input().split())
	for i in range(l, r + 1):
		p[i] = False
	n -= 1
ans = 0
b = []
for i in range(1, len(p)):
	if p[i]:
		ans += 1
		b += [i]
print(ans)
print(' '.join(map(str, b)))


a = list(input().split(' '))
(n, m) = (int(a[0]), int(a[1]))
a = list()
res = set((i for i in range(1, m + 1)))
for _ in range(n):
	a = list(input().split(' '))
	(l, r) = (int(a[0]), int(a[1]))
	for i in range(l, r + 1):
		if i in res:
			res.remove(i)
print(len(res))
if len(res) > 0:
	for x in res:
		print(x, end=' ')


(n, m) = map(int, input().split())
l = []
lst = []
for i in range(1, m + 1):
	l.append(i)
for i in range(n):
	(a, b) = map(int, input().split())
	for j in range(a, b + 1):
		if j in l:
			number = l.index(j)
			l[number] -= j
for value in l:
	if value > 0:
		lst.append(value)
print(len(lst))
print(*lst)


l = [int(x) for x in input().split()]
n = l[0]
m = l[1]
r = [0] * m
for i in range(n):
	p = [int(x) for x in input().split()]
	l1 = p[0]
	r1 = p[1]
	for j in range(l1 - 1, r1):
		r[j] = -1
cnt = 0
x = []
for i in range(m):
	if r[i] == 0:
		cnt += 1
		x.append(i + 1)
print(cnt)
print(*x)


def draw(l, r):
	global a
	for i in range(l - 1, r):
		a[i] = 1
(n, m) = map(int, input().split())
a = [0] * m
for i in range(n):
	(l, r) = map(int, input().split())
	draw(l, r)
print(a.count(0))
c = []
for i in range(m):
	if a[i] == 0:
		c.append(i + 1)
print(*c)


(n, M) = [int(x) for x in input().split()]
m = []
a = []
for i in range(n):
	m.append(list(map(int, input().split())))
m.sort(key=lambda x: x[0])
for i in range(1, M + 1):
	a.append(i)
for i in range(n):
	for j in range(m[i][0], m[i][1] + 1):
		if j in a:
			a.remove(j)
print(len(a))
print(*a)


(a, b) = input().split()
li = []
test = []
for i in range(int(a)):
	(x, y) = input().split()
	for i in range(int(x), int(y) + 1):
		test.append(i)
for i in range(1, int(b) + 1):
	if i not in test:
		li.append(i)
print(len(li))
for i in li:
	print(i, end=' ')


n = [int(i) for i in input().split()]
l = []
lst = []
for i in range(n[0]):
	l = [int(j) for j in input().split()]
	lst += [i for i in range(l[0], l[1] + 1)]
lst = sorted(list(set(lst)))
l1 = [i for i in range(1, n[1] + 1)]
print(len(list(set(l1) - set(lst))))
print(' '.join(list(map(str, sorted(list(set(l1) - set(lst)))))))


(n, m) = map(int, input().split())
seen = [False] * (m + 1)
for i in range(n):
	(r, l) = map(int, input().split())
	for j in range(r, l + 1):
		seen[j] = True
cnt_ans = 0
ans = []
for i in range(1, m + 1):
	if not seen[i]:
		cnt_ans += 1
		ans.append(i)
print(cnt_ans)
for q in ans:
	print(q, end=' ')


n = list(map(int, input().split()))
(l, k) = ([], [])
count = 0
for i in range(1, n[1] + 1):
	l.append(i)
for i in range(n[0]):
	m = list(map(int, input().split()))
	for i in range(m[0] - 1, m[1]):
		l[i] = 'j'
for i in range(n[1]):
	if l[i] != 'j':
		count += 1
		k.append(l[i])
if len(k) == 0:
	print(0)
else:
	print(count)
	print(*k)


(num, limit) = list(map(int, input().split()))
used = set()
for _ in range(num):
	(low, high) = list(map(int, input().split()))
	for n in range(low, high + 1):
		used.add(n)
unused = [str(n) for n in range(1, limit + 1) if n not in used]
print(len(unused))
print(' '.join(unused))


(n, m) = map(int, input().split())
sp = [1] * (m + 1)
sp[0] = 0
for _ in range(n):
	(l, r) = map(int, input().split())
	for i in range(l, r + 1):
		sp[i] = 0
print(sp.count(1))
for i in range(m + 1):
	if sp[i] == 1:
		print(i, end=' ')


(n, m) = map(int, input().split())
otrs = []
for i in range(n):
	(a, b) = map(int, input().split())
	otrs.append([a, b])
ans = []
for i in range(1, m + 1):
	flag = True
	for j in range(n):
		if i >= otrs[j][0] and i <= otrs[j][1]:
			flag = False
			break
	if flag:
		ans.append(i)
print(len(ans))
print(*ans)


(n, m) = map(int, input().strip().split())
flag = [0] * 101
sum = 0
glob = []
for i in range(n):
	(li, ri) = map(int, input().strip().split())
	flag[li - 1] += 1
	flag[ri] -= 1
for i in flag:
	sum += i
	glob.append(sum)
no = True
result = []
for i in range(m):
	if glob[i] == 0:
		result.append(str(i + 1))
		no = False
if no == True:
	print('0')
else:
	print(len(result))
	print(' '.join(result).strip())


(n, m) = [int(x) for x in input().split()]
arr = [True] * (m + 1)
for _ in range(n):
	(a, b) = [int(x) for x in input().split()]
	for i in range(a, b + 1):
		arr[i] = False
res1 = 0
res2 = []
for i in range(1, m + 1):
	if arr[i]:
		res1 += 1
		res2.append(i)
print(res1)
print(*res2)


s = input()
data = s.split()
n = int(data[0])
m = int(data[1])
adad = []
for i in range(0, n):
	s = input()
	data = s.split()
	for k in range(int(data[0]), int(data[1]) + 1):
		if k not in adad:
			adad.append(k)
ans = ''
tedad = 0
for i in range(1, m + 1):
	if i not in adad:
		tedad += 1
		ans += str(i) + ' '
print(tedad)
print(ans)


n = list(map(int, input().split(' ')))
m = []
for i in range(n[0]):
	k = list(map(int, input().split(' ')))
	for j in range(k[0], k[1] + 1):
		if m.count(str(j)) <= 0:
			m.append(j)
cnt = 0
l = []
for i in range(1, n[1] + 1):
	if m.count(i) <= 0:
		cnt += 1
		l.append(i)
print(cnt)
for i in l:
	print(i, end=' ')


N = list(map(int, input().split()))
MAT = [1 for __ in range(N[1])]
for _ in range(N[0]):
	TMP = list(map(int, input().split()))
	for __ in range(TMP[0] - 1, TMP[1]):
		MAT[__] = 0
INDEX = 0
COUNTER = 0
WTF = []
while True:
	if MAT[INDEX:].count(1) > 0:
		FIND = MAT.index(1, INDEX)
		WTF.append(FIND + 1)
		COUNTER += 1
		INDEX = FIND + 1
	else:
		break
print(COUNTER)
print(*WTF, sep=' ')


(n, m) = map(int, input().split())
a = [0 for i in range(m)]
ans = []
le = 101
ri = 0
for i in range(n):
	(l, r) = input().split()
	for i in range(int(l) - 1, int(r), 1):
		a[i] = 1
print(a.count(0))
for i in range(m):
	if a[i] == 0:
		print(i + 1, '', end='')


(n, m) = [int(i) for i in input().split()]
Ox = [i for i in range(1, m + 1)]
lr = []
for i in range(n):
	lr.append([int(i) for i in input().split()])
for i in lr:
	for j in range(i[0], i[1] + 1):
		try:
			Ox.remove(j)
		except:
			continue
print(len(Ox))
for i in Ox:
	print(i, end=' ')


(n, m) = map(int, input().split())
w = [0] * 101
for j in range(n):
	(l, r) = [int(x) for x in input().split()]
	for k in range(l, r + 1):
		w[k] = 1
t = []
for j in range(1, m + 1):
	if w[j] == 0:
		t.append(j)
print(len(t))
print(*t)


(n, m) = map(int, input().split())
arr = [[], []]
for i in range(n):
	(a, b) = map(int, input().split())
	arr[0].append(a)
	arr[1].append(b)
count = 0
answers = []
for num in range(1, m + 1):
	ok = True
	for i in range(n):
		if arr[0][i] <= num <= arr[1][i]:
			ok = False
	if ok:
		count += 1
		answers.append(num)
print(count)
for i in answers:
	print(i, end=' ')


(n, m) = map(int, input().split())
flags = [False] * (m + 1)
for _ in range(n):
	(l, u) = map(int, input().split())
	for i in range(l, u + 1):
		flags[i] = True
res = []
for i in range(1, m + 1):
	if not flags[i]:
		res.append(i)
print(len(res))
print(' '.join([str(v) for v in res]))


(n, m) = map(int, input().split())
arr = [0] * m
for _ in range(n):
	(l, r) = map(int, input().split())
	for i in range(l - 1, r):
		arr[i] = 1
print(m - sum(arr))
for i in range(m):
	if arr[i] == 0:
		print(i + 1, end=' ')


(n, m) = [int(x) for x in input().split(' ')]
used = [0 for i in range(m + 1)]
for i in range(n):
	(a, b) = [int(x) for x in input().split(' ')]
	for j in range(a, b + 1):
		used[j] = 1
ans = []
for i in range(1, m + 1):
	if not used[i]:
		ans.append(i)
print(len(ans))
print(' '.join([str(x) for x in ans]))


(n, k) = map(int, input().split())
x1 = []
y1 = []
for i in range(n):
	(x, y) = map(int, input().split())
	x1.append(x)
	y1.append(y)
c = 0
p = []
for i in range(n):
	for j in range(y1[i] + 1):
		if j >= x1[i] and j <= y1[i]:
			p.append(j)
p.sort()
z = []
for i in range(1, k + 1):
	if i in p:
		continue
	else:
		c += 1
		z.append(i)
z.sort()
print(c)
if c > 0:
	for i in range(c):
		print(z[i], end=' ')


ar = [int(i) for i in input().split()]
n = ar[0]
m = ar[1]
ar2 = []
arx = []
for j in range(0, n):
	arx = [int(i) for i in input().split()]
	ar2.append(arx)
ary = []
for i in ar2:
	for k in range(i[0], i[1] + 1):
		ary.append(k)
ary = list(set(ary))
arf = []
for i in range(1, m + 1):
	if i not in ary:
		arf.append(i)
print(len(arf))
if len(arf) > 0:
	for i in arf:
		print(i, end=' ')


(n, m) = list(map(int, input().split()))
c = []
for i in range(n):
	b = list(map(int, input().split()))
	c.append(b)
d = []
for j in range(1, m + 1):
	t = True
	for k in range(n):
		if j >= c[k][0] and j <= c[k][1]:
			t = False
			break
	if t:
		d.append(j)
l = len(d)
print(l)
for i in range(l):
	print(d[i], end=' ')


(n, m) = [int(i) for i in input().split()]
a = []
kol = 0
b = []
for j in range(n):
	(x, y) = [int(i) for i in input().split()]
	a.append([x, y])
for i in range(1, m + 1):
	c = 0
	for j in range(n):
		if i < a[j][0] or a[j][1] < i:
			c += 1
	if c == n:
		kol += 1
		b.append(i)
print(kol)
for i in b:
	print(i, end=' ')


a = lambda : map(int, input().split())
(n, m) = a()
b = lambda x, y: {*range(x, y + 1)}
c = b(1, m)
for _ in range(n):
	c -= b(*a())
print(len(c))
print(*c)


(a, b) = map(int, input().split())
k = 0
q = []
p = []
for i in range(a):
	(c, d) = map(int, input().split())
	for j in range(c, d + 1):
		q = q + [j]
for w in range(1, b + 1):
	if q.count(w) == 0:
		k += 1
		p = p + [w]
print(k)
for t in p:
	print(t, end=' ')


s = input()
(n, m) = s.split()
count = 0
total_digs = [x for x in range(1, int(m) + 1)]
while count < int(n):
	l = input()
	(l1, r1) = l.split()
	digs = [x for x in range(int(l1), int(r1) + 1)]
	total_digs = [x for x in total_digs if x not in digs]
	count += 1
print(len(total_digs))
total_digs = [str(x) for x in total_digs]
print(' '.join(total_digs))


(n, m) = map(int, input().split())
lri = [list(map(int, input().split())) for i in range(n)]
ai = [1] * (m + 1)
for i in range(n):
	for j in range(lri[i][0], lri[i][1] + 1):
		ai[j] = 0
ans = 0
for i in range(m + 1):
	ans += ai[i]
print(ans - 1)
for i in range(1, m + 1):
	if ai[i] == 1:
		print(i, end=' ')


(l, r) = ([], [])
(n, m) = map(int, input().split())
for i in range(n):
	(a, b) = map(int, input().split())
	l.append(a)
	r.append(b)
a = 0
b = []
for i in range(1, m + 1):
	for k in range(n):
		if i < l[k] or i > r[k]:
			a += 1
	if a == n:
		b.append(i)
	a = 0
print(len(b))
print(*b)


gi = lambda : list(map(int, input().split(' ')))
(n, m) = gi()
L = [0 for e in range(m + 1)]
for k in range(n):
	(x, y) = gi()
	for k in range(x, y + 1):
		L[k] = 1
ans = 0
M = []
for k in range(1, m + 1):
	if not L[k]:
		M.append(k)
		ans += 1
print(ans)
print(' '.join(map(str, M)))


(n, m) = (int(i) for i in input().split())
l = [i for i in range(1, m + 1)]
for i in range(n):
	(l1, r1) = (int(i) for i in input().split())
	for j in range(l1, r1 + 1):
		if j in l:
			l.remove(j)
print(len(l))
print(*l)


(n, m) = list(map(int, input().split()))
r = [0] * (m + 1)
for _ in range(n):
	(a, b) = list(map(int, input().split()))
	for j in range(a, b + 1):
		r[j] = 1
print(r[1:].count(0))
for i in range(1, m + 1):
	if r[i] == 0:
		print(i, end=' ')


import sys
(n, m) = map(int, input().split())
listwa = list(range(1, m + 1))
for itemwa in range(n):
	(li, r) = map(int, input().split())
	if len(listwa) == 0:
		continue
	for item in range(li, r + 1):
		if item in listwa:
			listwa.remove(item)
print(len(listwa))
if len(listwa) != 0:
	print(*listwa)


(n, m) = map(int, input().split())
b = []
for j in range(1, m + 1):
	b.append(j)
c = 0
a = []
for _ in range(n):
	(l, r) = map(int, input().split())
	for i in range(m):
		if b[i] >= l and b[i] <= r:
			b[i] = 0
for i in range(m):
	if b[i] != 0:
		c += 1
		a.append(b[i])
print(c)
print(*a)


(n, m) = map(int, input().split())
seg = [list(map(int, input().split())) for i in range(n)]
ans = []
acc = [0] * (m + 2)
for (l, r) in seg:
	acc[l] += 1
	acc[r + 1] -= 1
for i in range(1, m + 1):
	acc[i] += acc[i - 1]
	if acc[i] == 0:
		ans.append(i)
print(len(ans))
print(*ans)


(n, m) = [int(i) for i in input().split()]
A = [[int(i) for i in input().split()] for j in range(n)]
R = [0] * (m + 2)
for (a, b) in A:
	R[a] += 1
	R[b + 1] -= 1
ans = []
for i in range(1, m + 1):
	R[i] += R[i - 1]
	if R[i] == 0:
		ans.append(i)
print(len(ans))
print(*ans)


(n, m) = [int(x) for x in input().split()]
p = set()
q = {i for i in range(1, m + 1)}
for i in range(n):
	(x, y) = [int(x) for x in input().split()]
	for i in range(x, y + 1):
		p.add(i)
e = q - p
print(len(e) if e else 0)
print(*e)


(z, x) = map(int, input().split())
a = [_ + 1 for _ in range(x)]
e = []
for i in range(z):
	(q, w) = map(int, input().split())
	for o in range(w - q + 1):
		if q + o - 1 not in e:
			e.append(q + o - 1)
e.sort()
e.reverse()
for f in range(len(e)):
	a.pop(e[f])
print(len(a))
print(*a)


b = input()
b = b.split()
a = int(b[0])
bound = int(b[1])
content = []
for i in range(a):
	x = input()
	x = x.split()
	x[0] = int(x[0])
	x[1] = int(x[1])
	content.append(x)
numbers = range(1, bound + 1)
truenumbers = []
for i in numbers:
	falsity = 0
	for j in content:
		if j[0] <= i and i <= j[1]:
			falsity = 1
			break
	if falsity == 0:
		truenumbers.append(i)
string = ''
for i in truenumbers:
	string += str(i)
	string += ' '
print(len(truenumbers))
print(string)


(x, up) = map(int, input().split())
ans = []
for i in range(x):
	(m, n) = map(int, input().split())
	for j in range(m, n + 1):
		ans.append(j)
ans = ans
rem = []
for k in range(1, up + 1):
	if k not in ans:
		rem.append(k)
print(len(rem))
for i in rem:
	print(i, end=' ')


n = input().split(' ')
l = [0] * int(n[1])
for i in range(int(n[0])):
	p = input().split(' ')
	for k in range(int(p[0]), int(p[1]) + 1):
		l[k - 1] = 1
if l.count(0) == 0:
	print(0)
else:
	print(l.count(0))
	t = 0
	x = ' '
	for i in range(len(l)):
		if t == l.count(0) - 1:
			x = ''
		if l[i] == 0:
			print(i + 1, end=x)
			t += 1


(n, m) = map(int, input().split())
a = set(range(1, m + 1))
b = set()
for i in range(n):
	(x, y) = map(int, input().split())
	for i in range(x, y + 1):
		b.add(i)
for i in b:
	a.discard(i)
print(len(a))
for i in a:
	print(i, end=' ')
print()


(n, m) = map(int, input().split())
points = [0] * m
for i in range(n):
	(p1, p2) = map(int, input().split())
	for j in range(p1 - 1, p2):
		points[j] = 1
output = []
for i in range(len(points)):
	if points[i] == 0:
		output.append(i + 1)
if len(output) > 0:
	print(len(output))
	print(*output)
else:
	print(0)


(N, M) = [int(x) for x in input().split()]
sk = []
for _ in range(N):
	sk.append([int(x) for x in input().split()])
ats = []
for i in range(1, M + 1):
	geras = True
	for j in sk:
		if j[0] <= i and j[1] >= i:
			geras = False
	if geras:
		ats.append(i)
print(len(ats))
for i in ats:
	print(i, end=' ')


(n, m) = map(int, input().split())
lr = [list(map(int, input().split())) for _ in range(n)]
ans = []
for i in range(1, m + 1):
	ans.append(i)
for lrj in lr:
	for k in range(lrj[0], lrj[1] + 1):
		ans[k - 1] = 0
ans = [p for p in ans if p != 0]
print(len(ans))
print(' '.join(map(str, ans)))


k = list(map(int, input().split()))
g = [0] * (k[1] + 1)
for i in range(k[0]):
	m = list(map(int, input().split()))
	for j in range(m[0], m[1] + 1):
		g[j] = g[j] + 1
count = 0
f = []
for i in range(k[1] + 1):
	if g[i] == 0:
		count = count + 1
		f.append(i)
print(count - 1)
print(*f[1:])


n = input().split()
a = int(n[0])
b = int(n[1])
array = []
total = 0
array1 = []
for i in range(a):
	angka = input().split()
	j = int(angka[0])
	k = int(angka[1])
	for hasil in range(j, k + 1):
		array += [hasil]
for i in range(0, b):
	if i + 1 not in array:
		total += 1
		array1 += [i + 1]
print(total)
for i in array1:
	print(i, end=' ')


(n, m) = map(int, input().split())
f = lambda a, b: set(range(a, b + 1))
v = f(1, m)
for i in range(n):
	v -= f(*map(int, input().split()))
print(len(v))
print(' '.join(map(str, v)))


(n, k) = map(int, input().split())
d = {i for i in range(1, k + 1)}
for i in range(n):
	(c, e) = map(int, input().split())
	f = {j for j in range(c, e + 1)}
	d -= f
print(len(d))
print(*d)


L = []
for i in range(105):
	L.append(0)
(n, m) = map(int, input().split())
for i in range(n):
	(l, r) = map(int, input().split())
	for j in range(l, r + 1):
		L[j] = 1
ans = []
for i in range(1, m + 1):
	if L[i] == 0:
		ans.append(i)
print(len(ans))
for x in ans:
	print(x, end=' ')


import math as ma
from sys import exit
from decimal import Decimal as dec

def li():
	return list(map(int, input().split()))

def modInverse(a, m):
	m0 = m
	y = 0
	x = 1
	if m == 1:
		return 0
	while a > 1:
		q = a // m
		t = m
		m = a % m
		a = t
		t = y
		y = x - q * y
		x = t
	if x < 0:
		x = x + m0
	return x
m = 10000019

def binomialCoefficient(n, k):
	if k > n - k:
		k = (n - k) % m
	res = 1
	for i in range(k):
		res = res * (n - i) % m
		res = res * modInverse(i + 1, m) % m
	return res

def num():
	return map(int, input().split())

def nu():
	return int(input())

def find_gcd(x, y):
	while y:
		(x, y) = (y, x % y)
	return x
(n, m) = num()
a = [0] * m
for ii in range(n):
	(l, r) = num()
	for i in range(l - 1, r):
		a[i] = 1
c = 0
ll = []
for i in range(m):
	if a[i] == 0:
		c += 1
		ll.append(i + 1)
print(c)
print(*ll, sep=' ')


(n, m) = map(int, input().split())
l = [0] * 105
for i in range(0, n):
	(a, b) = map(int, input().split())
	for i in range(a, b + 1):
		l[i] = 1
y = []
for i in range(1, m + 1):
	if l[i] == 0:
		y.append(i)
k = len(y)
print(k)
print(*y)


(n, m) = list(map(int, input().split()))
a = [_ + 1 for _ in range(m)]
c = []
for i in range(n):
	(q, w) = map(int, input().split())
	for o in range(w - q + 1):
		if q + o - 1 not in c:
			c.append(q + o - 1)
c.sort()
c.reverse()
for f in range(len(c)):
	a.pop(c[f])
print(len(a))
print(*a)


(num_of_seg, up_bound) = map(int, input().split())
lst = []
a = []
v = up_bound + 1
for i in range(num_of_seg):
	(l, r) = map(int, input().split())
	for j in range(l, r + 1):
		lst.append(j)
s = list(set(lst))
for b in list(range(v))[1:]:
	if b not in s:
		a.append(b)
print(len(a))
for li in a:
	print(li, end=' ')


(n, m) = map(int, input().split())
l = [*range(1, m + 1)]
s = set()
c = 0
ans = []
for i in range(n):
	(x, y) = map(int, input().split())
	for i in range(x, y + 1):
		s.add(i)
for i in l:
	if i not in s:
		c += 1
		ans.append(i)
print(c)
print(*ans)


def check(n):
	for i in ans:
		if n in i:
			return False
	return True
(n, m) = map(int, input().split())
ans = []
answer = []
for i in range(n):
	(l, r) = map(int, input().split())
	ans.append([i for i in range(l, r + 1)])
for i in range(1, m + 1):
	if check(i):
		answer.append(str(i))
print(len(answer))
print(' '.join(answer))


(n, m) = map(int, input().split())
ff = []
for i in range(0, m):
	ff.append(True)
for i in range(0, n):
	(l, r) = map(int, input().split())
	for j in range(l - 1, r):
		ff[j] = False
print(ff.count(True))
for i in range(0, m):
	if ff[i]:
		print(i + 1, end=' ')


def parse_input(text):
	split_text = text.split(' ')
	return {'quantity': split_text[0], 'maximum': split_text[1]}

def populate_numbers_array(array, start_value, final_value):
	for num in range(start_value, final_value + 1):
		if num not in array:
			array.append(num)
	array.sort()

def main():
	first_input = input()
	parsed_input = parse_input(first_input)
	lines_quantity = int(parsed_input['quantity'])
	maximum_value = int(parsed_input['maximum'])
	numbers_array = []
	for index in range(0, lines_quantity):
		second_input = input()
		split_second_input = second_input.split(' ')
		start_value = int(split_second_input[0])
		final_value = int(split_second_input[1])
		populate_numbers_array(numbers_array, start_value, final_value)
	all_numbers_in_range = []
	populate_numbers_array(all_numbers_in_range, 1, maximum_value)
	result = ''
	numbers_missing_quantity = 0
	for num in all_numbers_in_range:
		if num not in numbers_array:
			numbers_missing_quantity += 1
			result += str(num) + ' '
	print(numbers_missing_quantity)
	print(result)
	return
main()


(n, m) = map(int, input().split())
s = []
for __ in range(n):
	(l, r) = map(int, input().split())
	for i in range(l, r + 1):
		s.append(i)
t = set(s)
print(m - len(t))
for i in range(1, m + 1):
	if i not in t:
		print(i, end=' ')


(n, m) = map(int, input().split())
l = []
for t in range(n):
	(a, b) = map(int, input().split())
	l.append([a, b])
l1 = []
for i in range(1, m + 1):
	k = 0
	for j in range(n):
		if i >= l[j][0] and i <= l[j][1]:
			k = 1
			break
	if k == 0:
		l1.append(str(i))
if len(l1) == 0:
	print(0)
else:
	print(len(l1))
	print(' '.join(l1))


(a, b) = map(int, input().split())
l = []
k = [i for i in range(1, b + 1)]
for i in range(a):
	(x, y) = map(int, input().split())
	for j in range(x, y + 1):
		if j in k:
			k.remove(j)
print(len(k))
print(*k)


(n, k) = [int(i) for i in input().split()]
a = [0] * k
for _i in range(n):
	(l, r) = [int(i) for i in input().split()]
	l -= 1
	r -= 1
	for i in range(l, r + 1):
		a[i] += 1
print(a.count(0))
for i in range(len(a)):
	if a[i] == 0:
		print(i + 1, end=' ')


(n, m) = map(int, input().split())
points = {0}
ans = []
temp = list(map(int, range(1, m + 1)))
for i in range(n):
	(x, y) = map(int, input().split())
	points.update(range(x, y + 1))
for i in temp:
	if i not in points:
		ans.append(i)
print(len(ans))
print(*ans)


import re
import math
import decimal
import bisect

def read():
	return input().strip()

def iread():
	return int(input().strip())

def viread():
	return list(map(int, input().strip().split()))
segs = []
(n, m) = viread()
for i in range(n):
	(l, r) = viread()
	segs.append((l, False))
	segs.append((r, True))
segs.sort()
outside = set()
inside = 0
last = 0
for s in segs:
	if not inside:
		outside.update(range(last + 1, s[0]))
	elif segs[1]:
		last = s[0]
	inside += 1 if not s[1] else -1
outside.update(range(last + 1, m + 1))
print(len(outside))
if len(outside):
	print(*outside)


(n, m) = map(int, input().split())
atab = []
btab = []
for x in range(m + 1):
	if x != 0:
		atab.append(x)
for x in range(n):
	(a, b) = map(int, input().split())
	btab.append(a)
	btab.append(b)
	for x in range(a, b):
		btab.append(x)
btab.sort()
list(btab)
ctab = set(atab) - set(btab)
print(len(ctab))
c = list(ctab)
s = ' '
print(s.join(map(str, c)))


[m, n] = [int(c) for c in input().split()]
segments = []
points = n
good = []
for c in range(m):
	segments.append([int(c) for c in input().split()])
for c in range(1, n + 1):
	boo = True
	for segment in segments:
		if segment[0] <= c and segment[1] >= c:
			points -= 1
			boo = False
			break
	if boo:
		good.append(c)
print(points)
print(' '.join([str(c) for c in good]))


[n, m] = [int(x) for x in input().split()]
a = []
for i in range(0, n):
	a.append([int(x) for x in input().split()])
count = 0
b = []
for j in range(1, m + 1):
	flag = 0
	for i in range(0, n):
		if j >= a[i][0] and j <= a[i][1]:
			flag = 100
	if flag != 100:
		count = count + 1
		b.append(j)
print(count)
for e in b:
	print(e, end=' ')


def io_main():
	(n, m) = map(int, input().split())
	nums = set(range(1, m + 1))
	for _ in range(n):
		(a, b) = map(int, input().split())
		nums -= set(range(a, b + 1))
	print(len(nums))
	print(' '.join(map(str, nums)))
io_main()


a = input().split()
a[0] = int(a[0])
a[1] = int(a[1])
b = []
for i in range(a[0]):
	b.append(input().split())
	b[i][0] = int(b[i][0]) - 1
	b[i][1] = int(b[i][1]) - 1
c = [[n, 0] for n in range(a[1])]
for i in range(a[0]):
	if b[i][1] + 1 > a[1]:
		print(i, c, b, a)
		c[a[1]][1] = 1
	else:
		for l in range(b[i][0], b[i][1] + 1):
			c[l][1] = 1
temp = []
tempnum = 0
for i in range(a[1]):
	if c[i][1] == 0:
		temp.append(i + 1)
		tempnum += 1
if tempnum == 0:
	print(tempnum)
else:
	print(tempnum)
	for i in range(len(temp)):
		print(temp[i], end=' ')


(n, m) = map(int, input().split())
(f, x) = ([int(_) for _ in range(1, m + 1)], 0)
for _ in range(n):
	(l, r) = map(int, input().split())
	l -= 1
	for i in range(l, r):
		f[i] = ''
for i in range(len(f)):
	if f[i] != '':
		x += 1
print(x)
for i in range(len(f)):
	if f[i] != '':
		print(f[i], end=' ')


import math
import sys
(a, b) = map(int, input().split())
c = [1] * (b + 1)
c[0] = 0
for i in range(a):
	(d, e) = map(int, input().split())
	for f in range(d, e + 1):
		c[f] = 0
e = sum(c)
print(e)
if e != 0:
	for g in range(1, b + 1):
		if c[g] == 1:
			print(g, end=' ')


(n, m) = input().split()
a = []
b = []
for i in range(int(n)):
	(l, r) = input().split()
	for j in range(int(m)):
		if (j + 1 >= int(l) and j + 1 <= int(r)) and j + 1 not in b:
			b.append(j + 1)
for i in range(int(m)):
	if i + 1 not in b:
		a.append(i + 1)
print(len(a))
print(*a)


(n, m) = map(int, input().split())
mask = [1] * m
for _ in range(n):
	(m0, m1) = map(int, input().split())
	for i in range(m0, m1 + 1):
		mask[i - 1] = 0
print(sum(mask))
print(*[i + 1 for (i, x) in enumerate(mask) if x])


from collections import defaultdict
[n, lim] = map(int, input().split())
starts = defaultdict(lambda : 0)
ends = defaultdict(lambda : 0)
for _ in range(n):
	[s, e] = map(int, input().split())
	starts[s] += 1
	ends[e] += 1
inrangeof = 0
outofrange = []
for i in range(1, lim + 1):
	inrangeof += starts[i]
	if inrangeof == 0:
		outofrange.append(i)
	inrangeof -= ends[i]
print(len(outofrange))
if outofrange:
	print(' '.join(map(str, outofrange)))


(n, m) = map(int, input().split())
answer = 0
seq = [0 for i in range(m)]
for i in range(n):
	(l, r) = map(int, input().split())
	l -= 1
	r -= 1
	for j in range(l, r + 1):
		seq[j] = 1
ans = []
ind = 1
for el in seq:
	if el == 0:
		answer += 1
		ans.append(ind)
	ind += 1
print(answer)
if answer != 0:
	print(' '.join((str(el) for el in ans)))


(n, m) = list(map(int, input().split()))
f = [0] * n
l = list(range(1, m + 1))
for i in range(n):
	f[i] = list(map(int, input().split()))
for i in f:
	for i in range(i[0], i[1] + 1):
		if i in l:
			l.remove(i)
print(len(l))
print(' '.join(map(str, l)))


input_n_m = input()
n = int(input_n_m.split(' ')[0])
m = int(input_n_m.split(' ')[1])
segments = []
numbers = set()
ordered = set((x for x in range(1, m + 1)))
for i in range(n):
	input_a_b = input()
	a = int(input_a_b.split(' ')[0])
	b = int(input_a_b.split(' ')[1])
	segments.append([a, b])
for segment in segments:
	a = segment[0]
	b = segment[1]
	for num in range(a, b + 1):
		numbers.add(num)
result = ordered.difference(numbers)
if len(result) == 0:
	print(0)
else:
	print(len(result))
	print(' '.join((str(s) for s in result)))


(n, m) = map(int, input().split())
s = []
for _ in range(n):
	(l, r) = map(int, input().split())
	s.append((l, r))
s.sort(key=lambda x: x[0])
P = []
(i, j) = (1, 0)
while i < m + 1 and j < n:
	(l, r) = s[j]
	if i < l:
		P += list(range(i, l))
	i = max(r + 1, i)
	j += 1
if i <= m:
	P += list(range(i, m + 1))
print(len(P))
print(' '.join([str(x) for x in P]))


number_of_segment_and_upper = input().split()
number_of_segment = int(number_of_segment_and_upper[0])
upper = int(number_of_segment_and_upper[1])
segments = list()
i = 0
while i < number_of_segment:
	l_and_r = input().split()
	l = int(l_and_r[0])
	r = int(l_and_r[1])
	segments.append(l)
	segments.append(r)
	i += 1
d = list()
j = 1
while j <= upper:
	t = 0
	while t <= len(segments) - 1:
		if j in range(segments[t], segments[t + 1] + 1) and j not in d:
			d.append(j)
			break
		t += 2
	j += 1
if len(d) == 0:
	print(0)
else:
	diff = list()
	for j in range(1, upper + 1):
		if j not in d:
			diff.append(j)
	print(len(diff))
	print(*diff)


(n, m) = map(int, input().split())
d = [i for i in range(1, m + 1)]
s = []
for i in range(n):
	(n1, n2) = map(int, input().split())
	for i in range(n1, n2 + 1):
		if i not in s:
			s.append(i)
lis = []
for i in d:
	if i not in s:
		lis.append(i)
print(len(lis))
print(' '.join((str(i) for i in lis)))


[n, m] = [int(x) for x in input().split()]
start = [0] * (m + 1)
end = [0] * (m + 1)
for _ in range(n):
	[l, r] = [int(x) for x in input().split()]
	start[l] += 1
	end[r] += 1
c = 0
ans = []
covered = 0
for i in range(1, m + 1):
	covered += start[i]
	if covered == 0:
		c += 1
		ans.append(i)
	covered -= end[i]
print(c)
for i in ans:
	print(i, end=' ')


a = list(map(int, input().split()))
b = []
c = []
for i in range(1, a[1] + 1):
	c.append(i)
for i in range(0, 2 * a[0], 2):
	b.append(0)
	b.append(0)
	(b[i], b[i + 1]) = map(int, input().split())
	for k in range(b[i], b[i + 1] + 1):
		if c.count(k) != 0:
			c.remove(k)
print(len(c))
print(*c)


(a, b) = map(int, input().split())
b = list(range(1, b + 1))
for i in range(a):
	(x, y) = map(int, input().split())
	for j in range(x, y + 1):
		if j in b:
			b.remove(j)
print(len(b))
for i in b:
	print(i, end=' ')


(n, m) = list(map(int, input().split()))
countList = [0 for i in range(m + 1)]
for i in range(n):
	(l, r) = list(map(int, input().split()))
	for j in range(l, r + 1):
		countList[j] += 1
nonPoint = 0
listNonPoint = []
for i in range(1, m + 1):
	if countList[i] < 1:
		nonPoint += 1
		listNonPoint.append(i)
print(nonPoint)
print(*listNonPoint)


(n, m) = map(int, input().split())
a = []
for i in range(1, m + 1):
	a.append(i)
for o in range(n):
	(x1, x2) = map(int, input().split())
	for i in range(x1, x2 + 1):
		if i in a:
			a.remove(i)
if len(a) > 0:
	print(len(a))
	print(*a)
else:
	print('0')


(n, m) = list(map(int, input().split()))
segment = set(range(1, m + 1))
for x in range(n):
	(l, r) = list(map(int, input().split()))
	segment -= set(range(l, r + 1))
if len(segment) > 0:
	print(len(segment))
	print(*segment)
else:
	print(len(segment))


a = input().split()
b = int(a[0])
c = int(a[1])
g = []
for u in range(c):
	g.append(1)
for i in range(b):
	f = input().split()
	for j in range(int(f[0]) - 1, int(f[1])):
		g[j] = 0
print(g.count(1))
for i in range(c):
	if g[i] == 1:
		print(i + 1, end=' ')


(n, m) = map(int, input().split())
a = list(range(1, m + 1))
for i in range(n):
	(l, r) = map(int, input().split())
	for j in range(m + 1):
		if j >= l and j <= r:
			if j in a:
				a.remove(j)
if len(a) > 0:
	print(len(a))
	for i in a:
		print(i, end=' ')
else:
	print(len(a))


(n, m) = map(int, input().split())
s = []
for i in range(n):
	(l, r) = map(int, input().split())
	for j in range(l, r + 1):
		s.append(j)
ss = set(s)
l1 = []
for i in range(1, m + 1):
	if i not in ss:
		l1.append(i)
print(len(l1))
print(*l1)


(n, m) = map(int, input().split())
num = []
for i in range(n):
	(l, r) = map(int, input().split())
	for j in range(l, r + 1):
		num.append(j)
nu = list(set(num))
nu.sort()
print(m - len(nu))
for j in range(1, m + 1):
	if j not in nu:
		print(j, end=' ')


(n, m) = map(int, input().split())
track = [0] * (m + 1)
for _ in range(n):
	(l, r) = map(int, input().split())
	if l == r:
		track[l] = '-1'
	else:
		for i in range(l, r + 1):
			if track[i] == '1':
				continue
			track[i] = '-1'
res = []
for i in range(1, len(track)):
	if track[i] == 0:
		res.append(i)
print(len(res))
print(' '.join(map(str, res)))


import sys
sys.setrecursionlimit(2000)
from collections import Counter
from functools import reduce
(n, m) = [int(val) for val in sys.stdin.readline().split()]
points = set(range(1, m + 1))
for i in range(n):
	(l, r) = [int(val) for val in sys.stdin.readline().split()]
	for point in range(l, r + 1):
		if point in points:
			points.remove(point)
print(len(points))
for point in points:
	print(point, end=' ')
print('')


(n, m) = map(int, input().split())
a = [1] * (m + 1)
a[0] = 0
for i in range(n):
	(b, e) = map(int, input().split())
	for j in range(b, e + 1):
		a[j] = 0
ans = sum(a)
print(ans)
for i in range(1, m + 1):
	if a[i]:
		print(i, end=' ')


(n, m) = map(int, input().split())
d = []
for i in range(n):
	(a, b) = map(int, input().split())
	for i in range(a, b + 1):
		d.append(i)
d = list(set(d))
c = []
for i in range(1, m + 1):
	if i not in d:
		c.append(i)
if len(c) == 0:
	print(0)
else:
	print(len(c))
	for i in range(len(c)):
		print(c[i], end=' ')


(n, m) = map(int, input().split())
a = []
c = 0
b = set()
arr = []
for k in range(1, m + 1):
	a.append(k)
for i in range(n):
	(l, r) = map(int, input().split())
	for x in range(l, r + 1):
		b.add(x)
print(len(a) - len(b))
for i in a:
	if i not in b:
		print(i, end=' ')


def answer():
	a = input().split()
	a = [int(x) for x in a]
	n = a[0]
	high = a[1]
	i = 1
	c = []
	while n:
		a = [int(x) for x in input().split()]
		c.append(a)
		n -= 1
	low = 1
	z = [low]
	i = low
	while i <= high:
		z.append(i)
		i += 1
	d = []
	for x in z:
		if x not in d:
			d.append(x)
	if len(d) == 0:
		print(0)
		done = 1
	else:
		for x in c:
			i = min(x)
			while i <= max(x):
				if i in d:
					d.remove(i)
				i += 1
	print(len(d))
	c_out = ''
	i = 0
	while i < len(d):
		c_out += str(d[i])
		if i != len(d) - 1:
			c_out += ' '
		i += 1
	print(c_out)
answer()


from sys import stdout
(n, m) = map(int, input().split())
dic = set()
for _ in range(n):
	(l, r) = map(int, input().split())
	for i in range(l, r + 1):
		dic.add(i)
print(m - len(dic))
flg = False
for i in range(1, m + 1):
	if i not in dic:
		if flg:
			stdout.write(' ')
		stdout.write(str(i))
		flg = True
print()


(n, m) = map(int, input().split())
lst = []
for i in range(n):
	(l, r) = map(int, input().split())
	for i in range(l, r + 1):
		lst.append(i)
lst = list(set(lst))
lst1 = []
for i in range(1, m + 1):
	if i not in lst:
		lst1.append(i)
if len(lst1) == 0:
	print(0)
else:
	print(len(lst1))
	print(*lst1)


import sys
input = sys.stdin.readline
(n, m) = map(int, input().split())
e = [1] * (m + 1)
for i in range(n):
	(l, r) = map(int, input().split())
	for j in range(l, r + 1):
		e[j] = 0
print(sum(e[1:]))
for i in range(1, m + 1):
	if e[i] == 1:
		print(i, end=' ')


(n, m) = map(int, input().split())
cnt = [0] * (m + 2)
for i in range(n):
	(l, r) = map(int, input().split())
	cnt[l] += 1
	cnt[r + 1] -= 1
for i in range(1, m + 1):
	cnt[i] += cnt[i - 1]
mas = [i for i in range(1, m + 1) if cnt[i] == 0]
print(len(mas))
print(*mas)


(a, b) = map(int, input().split())
ans = 0
dic = {i: 0 for i in range(1, b + 1)}
for i in range(a):
	(x, y) = map(int, input().split())
	for j in range(x, y + 1):
		dic[j] = 1
for i in range(1, b + 1):
	if dic[i] == 0:
		ans += 1
print(ans)
for i in range(1, b + 1):
	if dic[i] == 0:
		print(i, end=' ')


(n, m) = map(int, input().split())
S = set()
for i in range(n):
	(L, R) = map(int, input().split())
	for i in range(L, R + 1):
		S.add(i)
L = []
for i in range(1, m + 1):
	if i not in S:
		L.append(i)
print(len(L))
print(*L)


import itertools
(n, m) = map(int, input().split())
s = [0 for i in range(m + 1)]
for i in range(n):
	(l, r) = map(int, input().split())
	l -= 1
	r -= 1
	s[l] += 1
	s[r + 1] += -1
s = list(itertools.accumulate(s))
cnt = 0
ans = []
for i in range(m):
	if s[i] == 0:
		cnt += 1
		ans.append(i + 1)
print(cnt)
print(*ans)


from sys import stdout
(n, m) = map(int, input().split())
tab = [0] * m
for i in range(n):
	(l, r) = map(int, input().split())
	for i in range(1, m + 1):
		if i >= l and i <= r:
			tab[i - 1] = 1
print(tab.count(0))
for i in range(m):
	if tab[i] == 0:
		stdout.write(str(i + 1) + ' ')


t = 1
while t:
	t -= 1
	(m, n) = map(int, input().split())
	l = [1 for i in range(n + 1)]
	count = n
	while m:
		m -= 1
		(a, b) = map(int, input().split())
		if a == b:
			if l[a] == 1:
				l[a] = 0
				count -= 1
		else:
			for i in range(a, b + 1):
				if l[i] == 1:
					l[i] = 0
					count -= 1
	print(count)
	for i in range(1, n + 1):
		if l[i] == 1:
			print(i, end=' ')
	print()


(n, m) = map(int, input().split(' '))
segment_points = set()
for _ in range(n):
	(l, r) = map(int, input().split(' '))
	segment_points.update(range(l, r + 1))
res = set(range(1, m + 1)) - segment_points
print(len(res))
for x in res:
	print(x, end=' ')


(n, m) = map(int, input().split())
arr = [list(map(int, input().split())) for i in range(n)]

def operation(x):
	for i in range(n):
		if arr[i][0] <= x and x <= arr[i][1]:
			return False
	return True
final = list(filter(operation, [i for i in range(1, m + 1)]))
print(len(final))
print(' '.join([str(x) for x in final]))


(n, m) = map(int, input().split())
qw = []
q = []
w = []
for i in range(1, m + 1):
	qw.append(i)
for i in range(n):
	(l, r) = map(int, input().split())
	q.append(l)
	w.append(r)
for i in range(n):
	for j in range(q[i] - 1, w[i]):
		qw[j] = 0
while 0 in qw:
	qw.remove(0)
print(len(qw))
for i in range(len(qw)):
	print(qw[i], end=' ')


(n, m) = map(int, input().strip().split())
a = [0] * m
k = 1
for i in range(m):
	a[i] = k
	k += 1
for _ in range(n):
	(l, r) = map(int, input().strip().split())
	for i in range(l, r + 1):
		if i in a:
			a.remove(i)
print(len(a))
for i in range(len(a)):
	print(a[i], end=' ')


(n, m) = map(int, input().split())
arr = [0 for i in range(0, m + 1)]
arr[0] = 1
for _ in range(n):
	(l, r) = map(int, input().split())
	for i in range(l, r + 1):
		arr[i] += 1
count = 0
ans = []
for i in range(1, m + 1):
	if arr[i] == 0:
		count += 1
		ans.append(i)
if count == 0:
	print(0)
else:
	print(count)
	for i in ans:
		print(i, end=' ')
	print(' ')


a = input().split()
n = int(a[0])
m = int(a[1])
b = []
for i in range(n):
	b.append(input().split())
c = []
for i in range(1, m + 1):
	for j in range(n):
		if int(b[j][0]) <= int(i) and int(i) <= int(b[j][1]):
			continue
		else:
			c.append(int(i))
d = []
for i in range(1, m + 1):
	if c.count(i) == n:
		d.append(i)
print(len(d))
for i in d:
	print(i, end=' ')


(n, m) = [int(i) for i in input().split()]
seg = [[int(i) for i in input().split()] for i in range(n)]
line = [i for i in range(m + 1)]
for i in range(n):
	for j in range(seg[i][0], seg[i][1] + 1):
		line[j] = 0
line = [i for i in line if i != 0]
print(len(line))
print(*line)


(n, m) = map(int, input().split(' '))
res = set(range(1, m + 1))
for _ in range(n):
	(l, r) = map(int, input().split(' '))
	res = res.difference(set(range(l, r + 1)))
print(len(res))
print(*res)


(n, m) = map(int, input().split())
lr = [list(map(int, input().split())) for _ in range(n)]
cnt = [0] * m
for seg in lr:
	for p in range(seg[0] - 1, seg[1]):
		cnt[p] += 1
a = len([cnt[i] for i in range(m) if cnt[i] == 0])
print(a)
if a == 0:
	print()
else:
	ans = []
	for (i, j) in enumerate(cnt):
		if j == 0:
			ans.append(str(i + 1))
	print(' '.join(ans))


(a, b) = map(int, input().split())
f = [0] * (b + 1)
for i in range(a):
	(c, d) = map(int, input().split())
	for j in range(c, d + 1):
		f[j] = 1
l = 0
ans = []
for i in range(1, len(f)):
	if f[i] == 0:
		ans.append(i)
		l += 1
print(l)
print(' '.join(map(str, ans)))


(n, m) = map(int, input().split())
ans = [x for x in range(1, m + 1)]
for _ in range(n):
	(l, r) = map(int, input().split())
	for i in range(l, r + 1):
		if i in ans:
			ans.remove(i)
print(len(ans))
print(*ans)


(n, limit) = map(int, input().split())
num = [False] * (limit + 1)
kx = 0
while kx < n:
	k = input().split()
	for i in range(int(k[0]), int(k[1]) + 1):
		num[i] = True
	kx += 1
count = 0
res = ''
for i in range(1, len(num)):
	if num[i] == False:
		count += 1
		res += str(i) + ' '
print(count)
print(res)


(n, bound) = map(int, input().split())
ar = []
for i in range(n):
	t = list(map(int, input().split()))
	ar += [t]
points = []
for i in range(1, bound + 1):
	valid = True
	for p in ar:
		if p[0] <= i and p[1] >= i:
			valid = False
			break
	if valid:
		points += [i]
print(len(points))
for p in points:
	print(p, end=' ')


f = lambda : map(int, input().split())
(n, m) = f()
s = set()
for _ in range(n):
	(l, r) = f()
	s = s.union({*range(l, r + 1)})
ans = [i for i in range(1, m + 1) if i not in s]
print([0, str(len(ans)) + '\n' + ' '.join([str(x) for x in ans])][ans != []])


(n, m) = map(int, input().split())
A = [0] * (m + 1)
for i in range(n):
	(a, b) = map(int, input().split())
	A[a - 1] += 1
	A[b] -= 1
c = 0
M = []
for i in range(m):
	c += A[i]
	if c == 0:
		M.append(i + 1)
print(len(M))
for i in range(len(M)):
	print(M[i], end=' ')


(n, k) = map(int, input().split())
f = []
l = []
for i in range(1, k + 1):
	f.append(i)
for i in range(n):
	(k, x) = map(int, input().split())
	for i in range(k, x + 1):
		l.append(i)
a = set(f)
b = set(l)
c = a.difference(b)
print(len(c))
c = list(c)
for i in range(len(c)):
	print(c[i], end=' ')


n = input().split()
mymax = int(n[1])
num = []
for i in range(1, mymax + 1):
	num.append(i)
for i in range(int(n[0])):
	d = input().split()
	for j in range(int(d[0]), int(d[1]) + 1):
		if j in num:
			num.remove(j)
if len(num) == 0:
	print(0)
else:
	print(len(num))
	s = ''
	for i in range(len(num)):
		s += str(num[i]) + ' '
	print(s)


(n, m) = map(int, input().split())
Co = [None] * n
for i in range(n):
	Co[i] = list(map(int, input().split()))
Co.sort()
X = set(range(1, m + 1))
for i in range(n):
	X = X - set(range(Co[i][0], Co[i][1] + 1))
print(len(X))
for i in X:
	print(i, end=' ')


l = list(map(int, input().split()))
n = l[0]
m = l[1]
k = 0
q = [i for i in range(1, m + 1)]
s = []
g = []
for i in range(n):
	p = list(map(int, input().split()))
	a = p[0]
	b = p[1]
	for j in range(a, b + 1):
		s.append(j)
for t in q:
	if t in s:
		continue
	else:
		k += 1
		g.append(t)
print(k)
for i in g:
	print(i, end=' ')


temp = input()
(n, m) = temp.split(' ')
(n, m) = (int(n), int(m))
segments = []
for s in range(n):
	temp = input()
	(l0, l1) = temp.split(' ')
	(l0, l1) = (int(l0), int(l1))
	segments.append([l0, l1])
result = []
notinline = 0
for num in range(1, m + 1):
	notin = False
	for l in segments:
		if num >= l[0] and num <= l[1]:
			notin = False
			break
		else:
			notin = True
	if notin == True:
		notinline += 1
		result.append(num)
print(notinline)
for i in result:
	print(i, end=' ')


(n, m) = map(int, input().split())
cord = []
for i in range(n):
	x = list(map(int, input().split()))
	cord.append(x)
count = 0
res = []
for i in range(1, m + 1):
	y = 1
	for j in cord:
		if i >= j[0] and i <= j[1]:
			y = 0
			break
	if y == 1:
		count += 1
		res.append(i)
print(count)
for i in res:
	print(i, end=' ')


(n, a) = map(int, input().strip().split(' '))
L = [0] * (a + 1)
for i in range(n):
	(l, r) = map(int, input().strip().split(' '))
	for j in range(l, r + 1):
		L[j] = L[j] + 1
D = []
for i in range(1, len(L)):
	if L[i] == 0:
		D.append(i)
print(len(D))
for i in range(len(D)):
	print(D[i], end=' ')


import math
from collections import defaultdict
ll = lambda : map(int, input().split())
ii = lambda : int(input())
(x, y) = ll()
s = set()
for i in range(1, y + 1):
	s.add(i)
for i in range(x):
	(a, b) = ll()
	for j in range(a, b + 1):
		if j in s:
			s.remove(j)
print(len(s))
print(*s)


x = input()
x1 = x.split()[0]
x2 = x.split()[1]
lst = []
for i in range(int(x1)):
	y = input()
	y1 = y.split()[0]
	y2 = y.split()[1]
	d = list(range(int(y1), int(y2)))
	lst.extend(d)
	lst.append(int(y1))
	lst.append(int(y2))
a = [item for item in list(range(1, int(x2) + 1)) if item not in lst]
print(len(a))
for f in a:
	print(f, end=' ')


(n, k) = map(int, input().split())
li = list(range(1, k + 1))
for i in range(n):
	(a, b) = map(int, input().split())
	for i in range(a, b + 1):
		if i in li:
			li.remove(i)
		else:
			pass
a = len(li)
print(a)
if a == 0:
	print()
else:
	for item in li:
		print(item, end=' ')


import sys
(n, m) = map(int, sys.stdin.readline().split())
tab = [False] * m
for loop in range(n):
	(d, f) = map(int, sys.stdin.readline().split())
	for i in range(d - 1, f, 1):
		tab[i] = True
out = list()
r = 0
for loop in range(m):
	if not tab[loop]:
		r += 1
		out.append(loop + 1)
print(r)
print(*out)


[n, m] = [int(x) for x in input().split()]
S = set()
for i in range(n):
	[l, r] = [int(x) for x in input().split()]
	S = S.union({x for x in range(l, r + 1)})
R = {x for x in range(1, m + 1)} - S
print(len(R))
print(*R, sep=' ')


(n, m) = map(int, input().split())
a = [i + 1 for i in range(m)]
for i in range(n):
	(l, r) = map(int, input().split())
	for j in range(l, r + 1):
		if j in a:
			a.remove(j)
print(len(a))
b = [str(el) for el in a]
print(' '.join(b))


(n, m) = [int(x) for x in input().split()]
a = set(range(1, m + 1))
s = set()
for i in range(n):
	(l, r) = [int(x) for x in input().split()]
	s1 = set(range(l, r + 1))
	s |= s1
ans = a.difference(s)
print(len(ans))
print(*ans)


(n, m) = map(int, input().split())
l = []
for i in range(0, m):
	l.append(i + 1)
l1 = []
for i in range(n):
	(a, b) = map(int, input().split())
	l1 += l[a - 1:b]
l = set(l)
l1 = set(l1)
ans = l.difference(l1)
ans = list(ans)
print(len(ans))
for x in ans:
	print(x, end=' ')


(n, m) = list(map(int, input().split(' ')))
c = set(range(1, m + 1))
for i in range(n):
	(li, ri) = list(map(int, input().split(' ')))
	c -= set(range(li, ri + 1))
print(len(c))
if len(c) > 0:
	print(*c)


(n, m) = map(int, input().split())
l = [i for i in range(1, m + 1)]
for i in range(n):
	(p, q) = map(int, input().split())
	for j in range(p, q + 1):
		if j in l:
			l.remove(j)
		else:
			continue
print(len(l))
if len(l) is not 0:
	for i in l:
		print(i, end=' ')
print()


import sys
(n, m) = map(int, sys.stdin.readline().split())
points = [0 for i in range(m + 1)]
for i in range(n):
	(l, r) = map(int, sys.stdin.readline().split())
	for j in range(l, r + 1):
		points[j] = 1
ans = []
for i in range(1, m + 1):
	if points[i] == 0:
		ans += [i]
print(len(ans))
if len(ans) > 0:
	print(' '.join((str(a) for a in ans)))


(num_seg, bound) = [int(num) for num in input().split()]
x_axis = [False for _ in range(1, bound + 1)]
for _ in range(num_seg):
	(point1, point2) = [int(num) for num in input().split()]
	for point in range(point1 - 1, point2):
		if x_axis[point] == False:
			x_axis[point] = True
remain_points = []
for i in range(len(x_axis)):
	if x_axis[i] == False:
		remain_points.append(i + 1)
size = len(remain_points)
print(size)
if size != 0:
	for i in range(size):
		remain_points[i] = str(remain_points[i])
	print(' '.join(remain_points))


import sys
(n, m) = map(int, sys.stdin.readline().split())
res = [1] * (m + 1)
for _ in range(n):
	(l, r) = map(int, sys.stdin.readline().split())
	for k in range(l, r + 1):
		res[k] = 0
print(sum(res) - res[0])
for i in range(1, len(res)):
	if res[i] == 1:
		print(i, end=' ')


from collections import Counter, defaultdict
BS = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ'

def to_base(s, b):
	res = ''
	while s:
		res += BS[s % b]
		s //= b
	return res[::-1] or '0'
alpha = 'abcdefghijklmnopqrstuvwxyz'
from math import floor, ceil, pi
primes = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211, 223, 227, 229, 233, 239, 241, 251, 257, 263, 269, 271, 277, 281, 283, 293, 307, 311, 313, 317, 331, 337, 347, 349, 353, 359, 367, 373, 379, 383, 389, 397, 401, 409, 419, 421, 431, 433, 439, 443, 449, 457, 461, 463, 467, 479, 487, 491, 499, 503, 509, 521, 523, 541, 547, 557, 563, 569, 571, 577, 587, 593, 599, 601, 607, 613, 617, 619, 631, 641, 643, 647, 653, 659, 661, 673, 677, 683, 691, 701, 709, 719, 727, 733, 739, 743, 751, 757, 761, 769, 773, 787, 797, 809, 811, 821, 823, 827, 829, 839, 853, 857, 859, 863, 877, 881, 883, 887, 907, 911, 919, 929, 937, 941, 947, 953, 967, 971, 977, 983, 991, 997, 1009, 1013, 1019, 1021, 1031, 1033, 1039, 1049, 1051, 1061, 1063, 1069, 1087, 1091, 1093, 1097, 1103, 1109, 1117, 1123, 1129, 1151, 1153, 1163, 1171, 1181, 1187, 1193, 1201, 1213, 1217, 1223, 1229, 1231, 1237, 1249, 1259, 1277, 1279, 1283, 1289, 1291, 1297, 1301, 1303, 1307, 1319, 1321, 1327, 1361, 1367, 1373, 1381, 1399, 1409, 1423, 1427, 1429, 1433, 1439, 1447, 1451, 1453, 1459, 1471, 1481, 1483, 1487, 1489, 1493, 1499, 1511, 1523, 1531, 1543, 1549, 1553, 1559, 1567, 1571, 1579, 1583, 1597, 1601, 1607, 1609, 1613, 1619, 1621, 1627, 1637, 1657, 1663, 1667, 1669, 1693, 1697, 1699, 1709, 1721, 1723, 1733, 1741, 1747, 1753, 1759, 1777, 1783, 1787, 1789, 1801, 1811, 1823, 1831, 1847, 1861, 1867, 1871, 1873, 1877, 1879, 1889, 1901, 1907, 1913, 1931, 1933, 1949, 1951, 1973, 1979, 1987, 1993, 1997, 1999, 2003, 2011, 2017, 2027, 2029, 2039, 2053, 2063, 2069, 2081, 2083, 2087, 2089, 2099, 2111, 2113, 2129, 2131, 2137, 2141, 2143, 2153, 2161, 2179, 2203, 2207, 2213, 2221, 2237, 2239, 2243, 2251, 2267, 2269, 2273, 2281, 2287, 2293, 2297, 2309, 2311, 2333, 2339, 2341, 2347, 2351, 2357, 2371, 2377, 2381, 2383, 2389, 2393, 2399, 2411, 2417, 2423, 2437, 2441, 2447, 2459, 2467, 2473, 2477, 2503, 2521, 2531, 2539, 2543, 2549, 2551, 2557, 2579, 2591, 2593, 2609, 2617, 2621, 2633, 2647, 2657, 2659, 2663, 2671, 2677, 2683, 2687, 2689, 2693, 2699, 2707, 2711, 2713, 2719, 2729, 2731, 2741, 2749, 2753, 2767, 2777, 2789, 2791, 2797, 2801, 2803, 2819, 2833, 2837, 2843, 2851, 2857, 2861, 2879, 2887, 2897, 2903, 2909, 2917, 2927, 2939, 2953, 2957, 2963, 2969, 2971, 2999, 3001, 3011, 3019, 3023, 3037, 3041, 3049, 3061, 3067, 3079, 3083, 3089, 3109, 3119, 3121, 3137, 3163, 3167, 3169, 3181, 3187, 3191, 3203, 3209, 3217, 3221, 3229, 3251, 3253, 3257, 3259, 3271, 3299, 3301, 3307, 3313, 3319, 3323, 3329, 3331, 3343, 3347, 3359, 3361, 3371, 3373, 3389, 3391, 3407, 3413, 3433, 3449, 3457, 3461, 3463, 3467, 3469, 3491, 3499, 3511, 3517, 3527, 3529, 3533, 3539, 3541, 3547, 3557, 3559, 3571, 3581, 3583, 3593, 3607, 3613, 3617, 3623, 3631, 3637, 3643, 3659, 3671, 3673, 3677, 3691, 3697, 3701, 3709, 3719, 3727, 3733, 3739, 3761, 3767, 3769, 3779, 3793, 3797, 3803, 3821, 3823, 3833, 3847, 3851, 3853, 3863, 3877, 3881, 3889, 3907, 3911, 3917, 3919, 3923, 3929, 3931, 3943, 3947, 3967, 3989, 4001, 4003, 4007, 4013, 4019, 4021, 4027, 4049, 4051, 4057, 4073, 4079, 4091, 4093, 4099, 4111, 4127, 4129, 4133, 4139, 4153, 4157, 4159, 4177, 4201, 4211, 4217, 4219, 4229, 4231, 4241, 4243, 4253, 4259, 4261, 4271, 4273, 4283, 4289, 4297, 4327, 4337, 4339, 4349, 4357, 4363, 4373, 4391, 4397, 4409, 4421, 4423, 4441, 4447, 4451, 4457, 4463, 4481, 4483, 4493, 4507, 4513, 4517, 4519, 4523, 4547, 4549, 4561, 4567, 4583, 4591, 4597, 4603, 4621, 4637, 4639, 4643, 4649, 4651, 4657, 4663, 4673, 4679, 4691, 4703, 4721, 4723, 4729, 4733, 4751, 4759, 4783, 4787, 4789, 4793, 4799, 4801, 4813, 4817, 4831, 4861, 4871, 4877, 4889, 4903, 4909, 4919, 4931, 4933, 4937, 4943, 4951, 4957, 4967, 4969, 4973, 4987, 4993, 4999, 5003, 5009, 5011, 5021, 5023, 5039, 5051, 5059, 5077, 5081, 5087, 5099, 5101, 5107, 5113, 5119, 5147, 5153, 5167, 5171, 5179, 5189, 5197, 5209, 5227, 5231, 5233, 5237, 5261, 5273, 5279, 5281, 5297, 5303, 5309, 5323, 5333, 5347, 5351, 5381, 5387, 5393, 5399, 5407, 5413, 5417, 5419, 5431, 5437, 5441, 5443, 5449, 5471, 5477, 5479, 5483, 5501, 5503, 5507, 5519, 5521, 5527, 5531, 5557, 5563, 5569, 5573, 5581, 5591, 5623, 5639, 5641, 5647, 5651, 5653, 5657, 5659, 5669, 5683, 5689, 5693, 5701, 5711, 5717, 5737, 5741, 5743, 5749, 5779, 5783, 5791, 5801, 5807, 5813, 5821, 5827, 5839, 5843, 5849, 5851, 5857, 5861, 5867, 5869, 5879, 5881, 5897, 5903, 5923, 5927, 5939, 5953, 5981, 5987, 6007, 6011, 6029, 6037, 6043, 6047, 6053, 6067, 6073, 6079, 6089, 6091, 6101, 6113, 6121, 6131, 6133, 6143, 6151, 6163, 6173, 6197, 6199, 6203, 6211, 6217, 6221, 6229, 6247, 6257, 6263, 6269, 6271, 6277, 6287, 6299, 6301, 6311, 6317, 6323, 6329, 6337, 6343, 6353, 6359, 6361, 6367, 6373, 6379, 6389, 6397, 6421, 6427, 6449, 6451, 6469, 6473, 6481, 6491, 6521, 6529, 6547, 6551, 6553, 6563, 6569, 6571, 6577, 6581, 6599, 6607, 6619, 6637, 6653, 6659, 6661, 6673, 6679, 6689, 6691, 6701, 6703, 6709, 6719, 6733, 6737, 6761, 6763, 6779, 6781, 6791, 6793, 6803, 6823, 6827, 6829, 6833, 6841, 6857, 6863, 6869, 6871, 6883, 6899, 6907, 6911, 6917, 6947, 6949, 6959, 6961, 6967, 6971, 6977, 6983, 6991, 6997, 7001, 7013, 7019, 7027, 7039, 7043, 7057, 7069, 7079, 7103, 7109, 7121, 7127, 7129, 7151, 7159, 7177, 7187, 7193, 7207, 7211, 7213, 7219, 7229, 7237, 7243, 7247, 7253, 7283, 7297, 7307, 7309, 7321, 7331, 7333, 7349, 7351, 7369, 7393, 7411, 7417, 7433, 7451, 7457, 7459, 7477, 7481, 7487, 7489, 7499, 7507, 7517, 7523, 7529, 7537, 7541, 7547, 7549, 7559, 7561, 7573, 7577, 7583, 7589, 7591, 7603, 7607, 7621, 7639, 7643, 7649, 7669, 7673, 7681, 7687, 7691, 7699, 7703, 7717, 7723, 7727, 7741, 7753, 7757, 7759, 7789, 7793, 7817, 7823, 7829, 7841, 7853, 7867, 7873, 7877, 7879, 7883, 7901, 7907, 7919]

def primef(n, plst=[]):
	if n == 1:
		return plst
	else:
		for m in primes:
			if n % m == 0:
				return primef(n // m, plst + [m])
		return primef(1, plst + [n])

def scoreBad(s):
	res = 0
	counter = 0
	while True:
		cur = int(counter)
		ok = True
		for i in range(len(s)):
			res += 1
			if s[i] == '+':
				cur += 1
			else:
				cur -= 1
			if cur < 0:
				ok = False
				break
		counter += 1
		if ok:
			break
	return res

def lmii():
	return list(map(int, input().split()))

def ii():
	return int(input())
(n, m) = lmii()
got = set()
for i in range(n):
	(l, r) = lmii()
	for j in range(l, r + 1):
		got.add(j)
print(m - len(got))
if m - len(got) > 0:
	a = set(range(1, m + 1)) - got
	print(' '.join(list(map(str, sorted(a)))))


(n, m) = map(int, input().split())
a = [0] * (m + 1)
for i in range(n):
	(l, r) = map(int, input().split())
	for j in range(l, r + 1):
		a[j] = 1
cnt = 0
for i in range(1, m + 1):
	if a[i] is 0:
		cnt = cnt + 1
print(cnt)
arr = []
for i in range(1, m + 1):
	if a[i] is 0:
		arr.append(str(i))
print(' '.join(arr))


(n, m) = map(int, input().split())
points = [1] * (m + 1)
for i in range(n):
	(a, b) = map(int, input().split())
	for k in range(a, b + 1):
		points[k] = 0
print(sum(points) - 1)
for i in range(1, m + 1):
	if points[i] > 0:
		print(i, end=' ')


import sys
input = sys.stdin.readline
(n, m) = list(map(int, input().split()))
dic = {}
seg = [list(map(int, input().split())) for _ in range(n)]
for c in seg:
	for i in range(c[0], c[1] + 1):
		dic[i] = 1
ans = list()
for i in range(1, m + 1):
	if i not in dic:
		ans.append(i)
print(len(ans))
for i in ans:
	print(i, end=' ')
print()


def segment_validator(l, r, m, list_b):
	for x in range(1, m + 1):
		if x >= l and x <= r and (x not in list_b):
			list_b.append(x)
	return list_b
(n, m) = map(int, input().split())
list_a = [x for x in range(1, m + 1)]
list_b = []
for x in range(0, n):
	(l, r) = map(int, input().split())
	segment_validator(l, r, m, list_b)
ans = set(list_a) - set(list_b)
if len(ans) >= 1:
	print(len(ans))
	print(*ans)
else:
	print(0)


(n, m) = map(int, input().split())
dots = set()
for i in range(m):
	dots.add(i + 1)
for i in range(n):
	(s, e) = map(int, input().split())
	for i in range(s, e + 1):
		dots.discard(i)
print(len(dots))
print(*dots)


(n, m) = input().split()
m = int(m)
n = int(n)
s = 0
a = []
r = []
for i in range(n):
	r += [[int(x) for x in input().split()]]
for i in range(1, m + 1):
	t = 0
	for j in range(n):
		if i <= r[j][1] and i >= r[j][0]:
			t = 1
			break
	if t == 0:
		s += 1
		a.append(i)
print(s)
for i in a:
	print(i, end=' ')


(n, m) = map(int, input().split())
A = [1] * m
for i in range(n):
	(l, r) = map(int, input().split())
	l -= 1
	r -= 1
	for j in range(l, r + 1):
		A[j] = 0
S = set()
for i in range(m):
	if A[i] == 1:
		S.add(i + 1)
print(len(S))
print(*S)


(n, m) = map(int, input().split())
nums = []
for i in range(n):
	(a, b) = map(int, input().split())
	for k in range(a, b + 1):
		nums.append(k)
count = 0
ans = []
for i in range(1, m + 1):
	if i not in nums:
		count += 1
		ans.append(str(i))
print(count)
print(' '.join(ans))


l = list(input().split())
n = int(l[0])
m = int(l[1])
s1 = {0}
for i in range(1, m + 1):
	s1.add(i)
s1.remove(0)
for j in range(n):
	q = list(input().split())
	lower = int(q[0])
	upper = int(q[1])
	s2 = {0}
	for i in range(lower, upper + 1):
		s2.add(i)
	s2.remove(0)
	s1 = s1.difference(s2)
if len(s1) != 0:
	print(len(s1))
	for i in s1:
		print(i, end=' ')
else:
	print(0)


(n, m) = [int(x) for x in input().split()]
segments = []
numerals = []
for i in range(0, n):
	(temp1, temp2) = [int(temp) for temp in input().split()]
	segments.append(temp1)
	segments.append(temp2)
for j in range(1, m + 1):
	numerals.append(j)
for k in range(1, m + 1):
	for l in range(0, len(segments) - 1, 2):
		if k >= segments[l] and k <= segments[l + 1]:
			numerals.remove(k)
			break
		else:
			pass
print(len(numerals))
if len(numerals) == 0:
	print()
else:
	for element in numerals:
		print(element, end=' ')


(n, m) = list(map(int, input().split()))
a = set()
for i in range(n):
	x = list(map(int, input().split()))
	for j in range(x[0], x[1] + 1):
		a.add(j)
if m != len(a):
	print(m - len(a))
	for k in range(1, m + 1):
		if not k in a:
			print(k, end=' ')
else:
	print(0)


(n, m) = map(int, input().split())
l1 = []
while n:
	(r, l) = map(int, input().split())
	for i in range(r, l + 1):
		l1.append(i)
	n = n - 1
s = list(set(l1))
print(m - len(s))
s1 = [i for i in range(1, m + 1)]
for i in s1:
	if i not in s:
		print(i, end=' ')


nm = input().split()
(n, m) = (int(nm[0]), int(nm[1]))
x = []
y = []
z = []
c = 0
for i in range(n):
	xy = input().split()
	x.append(int(xy[0]))
	y.append(int(xy[1]))
for i in range(1, m + 1):
	flag = 0
	for j in range(n):
		if x[j] <= i <= y[j]:
			flag = 1
	if flag == 0:
		c += 1
		z.append(i)
print(c)
for i in range(c):
	print(z[i], end=' ')


(n, m) = input().split()
(n, m) = (int(n), int(m))
S = set()
for i in range(n):
	(l, r) = input().split()
	(l, r) = (int(l), int(r))
	for j in range(l, r + 1):
		S.add(j)
if len(S) == m:
	print(0)
else:
	ans = []
	for i in range(1, m + 1):
		if i not in S:
			ans.append(i)
	print(len(ans))
	print(*ans)


(n, k) = [int(i) for i in input().split()]
s = []
for i in range(n):
	(l, u) = [int(i) for i in input().split()]
	s.extend([i for i in range(l, u + 1)])
s = {*[i for i in range(1, k + 1)]}.difference(set(s))
print(len(s))
if len(s) <= 0:
	print()
else:
	print(*s)


(n, m) = map(int, input().split())
a = set()
for i in range(1, m + 1):
	a.add(i)
for i in range(n):
	(st, en) = map(int, input().split())
	for j in range(st, en + 1):
		a.discard(j)
print(len(a))
print(*a)


(a, b) = map(int, input().split())
c = []
z = []
w = []
for i in range(1, b + 1):
	w.append(i)
for i in range(a):
	(d, e) = map(int, input().split())
	if e - d > 0:
		for j in range(d, e + 1):
			c.append(j)
	else:
		c.append(d)
for i in w:
	if i not in c:
		z.append(i)
print(len(z))
for i in z:
	print(i, end=' ')


(n, m) = map(int, input().split())
points = set(range(1, m + 1))
for _ in range(n):
	(l, r) = map(int, input().split())
	points -= set(range(l, r + 1))
print(len(points))
print(*points)


segments = []
(num_segments, upper_bound) = [int(x) for x in input().split(' ')]
for i in range(num_segments):
	(l, r) = [int(x) for x in input().split(' ')]
	segments.append((l, r))

def belongs_to(segment, point):
	(l, r) = segment
	return l <= point and point <= r
points_that_dont_belong_to_any_segment = []
for point in range(1, upper_bound + 1):
	belongs_to_any_segment = any((belongs_to(segment, point) for segment in segments))
	if not belongs_to_any_segment:
		points_that_dont_belong_to_any_segment.append(point)
print(len(points_that_dont_belong_to_any_segment))
print(' '.join((str(x) for x in points_that_dont_belong_to_any_segment)))


from __future__ import division, print_function
from fractions import Fraction
import sys
import os
from io import BytesIO, IOBase
from heapq import *
from math import gcd, factorial, floor, ceil
from copy import deepcopy
from collections import deque
from bisect import bisect_left as bl
from bisect import bisect_right as br
from bisect import bisect
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

def print(*args, **kwargs):
	(sep, file) = (kwargs.pop('sep', ' '), kwargs.pop('file', sys.stdout))
	at_start = True
	for x in args:
		if not at_start:
			file.write(sep)
		file.write(str(x))
		at_start = False
	file.write(kwargs.pop('end', '\n'))
	if kwargs.pop('flush', False):
		file.flush()
if sys.version_info[0] < 3:
	(sys.stdin, sys.stdout) = (FastIO(sys.stdin), FastIO(sys.stdout))
else:
	(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
from types import GeneratorType

def iterative(f, stack=[]):

	def wrapped_func(*args, **kwargs):
		if stack:
			return f(*args, **kwargs)
		to = f(*args, **kwargs)
		while True:
			if type(to) is GeneratorType:
				stack.append(to)
				to = next(to)
				continue
			stack.pop()
			if not stack:
				break
			to = stack[-1].send(to)
		return to
	return wrapped_func
mod = 10 ** 9 + 7

def inp():
	return sys.stdin.readline().rstrip('\r\n')

def out(var):
	sys.stdout.write(str(var))

def lis():
	return list(map(int, inp().split()))

def stringlis():
	return list(map(str, inp().split()))

def sep():
	return map(int, inp().split())

def strsep():
	return map(str, inp().split())

def zerolist(n):
	return [0] * n

def nextline():
	out('\n')

def testcase(t):
	for pp in range(t):
		solve(pp)

def printlist(a):
	for p in range(0, len(a)):
		out(str(a[p]) + ' ')

def google(p):
	print('Case #' + str(p) + ': ', end='')

def lcm(a, b):
	return a * b // gcd(a, b)

def power(x, y, p):
	res = 1
	x = x % p
	if x == 0:
		return 0
	while y > 0:
		if y & 1 == 1:
			res = res * x % p
		y = y >> 1
		x = x * x % p
	return res

def ncr(n, r):
	return factorial(n) // (factorial(r) * factorial(max(n - r, 1)))

def isPrime(n):
	if n <= 1:
		return False
	if n <= 3:
		return True
	if n % 2 == 0 or n % 3 == 0:
		return False
	i = 5
	while i * i <= n:
		if n % i == 0 or n % (i + 2) == 0:
			return False
		i = i + 6
	return True

def solve(case):
	(n, m) = sep()
	pre = [0] * (m + 5)
	for i in range(n):
		(a, b) = sep()
		for j in range(a, b + 1):
			pre[j] += 1
	ans = []
	for i in range(1, m + 1):
		if pre[i] == 0:
			ans.append(i)
	print(len(ans))
	print(' '.join((str(ans[i]) for i in range(len(ans)))))
testcase(1)


(n, m) = map(int, input().split())
a = [0] * (m + 1)
for i in range(n):
	(l, r) = map(int, input().split())
	for k in range(l, r + 1):
		a[k] = 1
indices = [i for (i, x) in enumerate(a) if x == 0]
print(len(indices) - 1)
for k in range(1, len(indices)):
	print(indices[k], end=' ')


(a, b) = map(int, input().split())
k = set(range(1, b + 1))
l = set()
for i in range(0, a):
	(n, m) = map(int, input().split())
	l = l | set(range(n, m + 1))
l = k - l
print(len(l))
print(' '.join(map(str, l)))


from __future__ import print_function
import sys
import math
import os.path
from copy import deepcopy
from functools import reduce
from collections import Counter, ChainMap, defaultdict
from itertools import cycle, chain
from queue import Queue, PriorityQueue
from heapq import heappush, heappop, heappushpop, heapify, heapreplace, nlargest, nsmallest
import bisect
from statistics import mean, mode, median, median_low, median_high
sys.setrecursionlimit(10 ** 9)

def log(*args, **kwargs):
	print(*args, file=sys.stderr, **kwargs)

def ni():
	return map(int, input().split())

def nio(offset):
	return map(lambda x: int(x) + offset, input().split())

def nia():
	return list(map(int, input().split()))

def toString(aList, sep=' '):
	return sep.join((str(x) for x in aList))

def toMapInvertIndex(aList):
	return {k: v for (v, k) in enumerate(aList)}

def sortId(arr):
	return sorted(range(len(arr)), key=lambda k: arr[k])
(n, m) = ni()
s = set(range(1, m + 1))
for i in range(n):
	(l, r) = ni()
	ss = set(range(l, r + 1))
	s -= ss
print(len(s))
print(toString(s))


[n, m] = list(map(int, input().split(' ')))
t = [0] * (m + 2)
for i in range(n):
	[a, b] = list(map(int, input().split(' ')))
	t[a] += 1
	t[b + 1] -= 1
for i in range(1, m + 1):
	t[i] += t[i - 1]
t.pop()
t.pop(0)
result = t.count(0)
print(result)
if result > 0:
	arr = []
	for i in range(m):
		if t[i] == 0:
			arr.append(i + 1)
	print(*arr)


(n, m) = map(int, input().split(' '))
x = [tuple(map(int, input().split(' '))) for i in range(n)]
dots = set(range(1, m + 1))
for (l, r) in x:
	dots -= set(range(l, r + 1))
dots = sorted(dots)
print(len(dots))
print(*dots)


(n, m) = map(int, input().split())
axis = [x for x in range(1, m + 1)]
for _ in range(n):
	(l, r) = map(int, input().split())
	for x in range(l, r + 1):
		if x in axis:
			axis.remove(x)
print(len(axis))
for x in axis:
	print(x, end=' ')
print('')


(n, m) = map(int, input().split())
s = []
for i in range(1, m + 1):
	s.append(i)
for _ in range(n):
	(l, r) = map(int, input().split())
	s[l - 1] = -1
	s[r - 1] = -1
	for i in range(l, r):
		s[i] = -1
ans = []
for i in s:
	if i != -1:
		ans.append(i)
if len(ans) != 0:
	print(len(ans))
	for i in ans:
		print('{}'.format(i), end=' ')
	print()
else:
	print('0')
	print()


(n, m) = map(int, input().split())
total_set = set(range(1, m + 1))
for i in range(n):
	(left, right) = map(int, input().split())
	total_set -= set(range(left, right + 1))
print(len(total_set))
print(*total_set)


(n, m) = map(int, input().split())
points = []
for i in range(n):
	(l, r) = map(int, input().split())
	points.extend(list(range(l, r + 1)))
un_points = []
for i in range(1, m + 1):
	if not i in points:
		un_points.append(str(i))
print(len(un_points))
print(' '.join(un_points))


(n, m) = list(map(int, input().split()))
section_m = frozenset([i for i in range(1, m + 1)])
for i in range(n):
	(l, r) = list(map(int, input().split()))
	section = frozenset([i for i in range(l, r + 1)])
	section_m -= section
print(len(section_m))
if section_m:
	print(' '.join(list(map(str, section_m))))


def readn():
	return int(input())

def readlist():
	return list(map(int, input().split()))

def readnos():
	return map(int, input().split())
(n, m) = readnos()
a = [0] * (m + 1)
for i in range(n):
	(l, r) = readnos()
	for j in range(l, r + 1):
		a[j] = 1
ans = []
cnt = 0
for i in range(1, m + 1):
	if a[i] == 0:
		cnt += 1
		ans.append(i)
if cnt == 0:
	print(0)
else:
	print(cnt)
	print(*ans, sep=' ')


(n, m) = map(int, input().split())
l = []
for i in range(n):
	(ai, bi) = map(int, input().split())
	for j in range(ai, bi + 1):
		l.append(j)
count = 0
for k in range(1, m + 1):
	if k not in l:
		count += 1
print(count)
if count == 0:
	print('')
else:
	for k in range(1, m + 1):
		if k not in l:
			print(k, end=' ')


(n, m) = map(int, input().split())
coords = [0 for i in range(m)]
for i in range(n):
	(x1, x2) = map(int, input().split())
	for j in range(x1 - 1, x2):
		coords[j] = 1
print(coords.count(0))
for i in range(m):
	if coords[i] == 0:
		print(i + 1, end=' ')
print()


(n, m) = list(map(int, input().split()))
matrix = []
array = []
num = int()
for x in range(n):
	(li, ri) = list(map(int, input().split()))
	for z in range(li, ri + 1):
		matrix.append(z)
matrix = sorted(set(matrix))
for y in range(1, m + 1):
	if matrix[-1] != m != m + 1:
		matrix.append(m + 1)
	if matrix[num] != y:
		array.append(str(y))
		num = num - 1
	num = num + 1
print(len(array))
print(' '.join(array))


(n, m) = [int(a) for a in input().split()]
segs = []
for i in range(n):
	segs.append([int(a) for a in input().split()])
points = list(range(1, m + 1))
for i in range(1, m + 1):
	for s in segs:
		if i >= s[0] and i <= s[1]:
			points.remove(i)
			break
print(len(points))
for p in points:
	print(p, end=' ')


(n, m) = map(int, input().split())
l = []
k = []
for i in range(n):
	(a, b) = map(int, input().split())
	k.append((a, b))

def foo(x):
	e = 0
	for p in k:
		if p[0] <= x <= p[1]:
			e += 1
	if e == 0:
		return True
	else:
		return False
for j in range(1, m + 1):
	if foo(j):
		l.append(j)
print(len(l))
print(*l)


def lis():
	return list(map(int, input().split()))
x = lis()
y = []
for i in range(x[0]):
	(a, b) = map(int, input().split())
	y.append(a)
	for g in range(a, b + 1):
		y.append(g)
	y.append(b)
d = set(y)
f = []
for j in range(1, x[1] + 1):
	if j not in y:
		f.append(j)
print(len(f))
print(*f)


l = list(map(int, input().split()))
l1 = []
l3 = []
n = 0
for _ in range(l[0]):
	l2 = list(map(int, input().split()))
	l1.append(l2)
for i in range(1, l[1] + 1):
	co = 0
	for j in l1:
		if i >= j[0] and i <= j[1]:
			continue
		else:
			co += 1
	if co == l[0]:
		n += 1
		l3.append(i)
print(n)
print(*l3, sep=' ')


(n, m) = list(map(int, input().split()))
a = [0] * (m + 1)
a[0] = 1
for _ in range(n):
	(st, end) = list(map(int, input().split()))
	for x in range(st, end + 1):
		if a[x] == 0:
			a[x] = 1
count = 0
for _ in range(m + 1):
	if a[_] == 0:
		count += 1
print(count)
for _ in range(m + 1):
	if a[_] == 0:
		print(_, end=' ')


(n, m) = list(map(int, input().split(' ')))
d = set()
for i in range(1, m + 1):
	d.add(i)
for i in range(n):
	(l, r) = list(map(int, input().split(' ')))
	for j in range(l, r + 1):
		d.discard(j)
print(len(d))
for i in d:
	print(i, end=' ')


(n, m) = map(int, input().split(' '))
d = {}
for i in range(n):
	(x, y) = map(int, input().split(' '))
	for j in range(x, y + 1):
		d[j] = 1
ans = []
for i in range(1, m + 1):
	if i not in d:
		ans.append(i)
if ans == []:
	print(0)
else:
	print(len(ans))
	print(*ans)


(a, b) = map(int, input().split())
c = list(range(1, b + 1))
for i in range(a):
	(d, e) = map(int, input().split())
	for i in range(d, e + 1):
		if i in c:
			c.remove(i)
print(len(c))
for i in c:
	print(i, end=' ')


inp = list(map(int, input().split(' ')))
segment = []
for i in range(inp[0]):
	segment.append(list(map(int, input().split(' '))))
actual = set(range(1, inp[1] + 1))
sub = []
for elem in segment:
	sub += range(elem[0], elem[1] + 1)
diff = actual.difference(set(sub))
print(len(diff))
print(*diff)


l = list(map(int, input().split()))
c = 0
k = []
n = []
while l[0] != 0:
	m = list(map(int, input().split()))
	for i in range(m[0], m[1] + 1):
		n.append(i)
	l[0] -= 1
for i in range(1, l[1] + 1):
	if i not in n:
		c = c + 1
		k.append(i)
print(c)
for i in k:
	print(i, end=' ')


(remaining_segments, deadpoint) = input().split()
remaining_segments = int(remaining_segments)
complete_segment = [0] * int(deadpoint)
while remaining_segments > 0:
	remaining_segments -= 1
	(start, end) = input().split()
	start = int(start) - 1
	end = int(end)
	for fill_segment in range(start, end):
		complete_segment[fill_segment] = 1
free_segments = []
number_free_segments = 0
for (idx, value) in enumerate(complete_segment):
	if value == 0:
		free_segments.append(str(idx + 1))
		number_free_segments += 1
if number_free_segments == 0:
	print(0)
else:
	print(number_free_segments)
	print(' '.join(free_segments))


(n, m) = map(int, input().split())
All_points = set([i for i in range(1, m + 1)])
for i in range(n):
	(l, r) = map(int, input().split())
	segment = set([i for i in range(l, r + 1)])
	All_points -= segment
All_points = list(All_points)
Len = len(All_points)
print(Len)
if Len > 0:
	for i in range(Len):
		print(All_points[i], end=' ')
	print('\n', end='')


(n, m) = map(int, input().split())
L = set(range(1, m + 1))
for _ in range(n):
	(l, r) = map(int, input().split())
	L = L - set(range(l, r + 1))
if len(L) > 0:
	print(len(L))
	print(*list(L))
else:
	print(0)


(n, m) = input().split()
n = int(n)
m = int(m)
ints = []
for i in range(1, m + 1):
	ints.append(i)
for i in range(0, n):
	(l, r) = input().split()
	l = int(l)
	r = int(r)
	for i in range(l, r + 1):
		if i in ints:
			ints.remove(i)
if len(ints) == 0:
	print('0')
else:
	print(len(ints))
	for i in ints:
		print(i, end=' ')


(n, m) = map(int, input().split())
general = set(range(1, m + 1))
for i in range(n):
	(l, r) = map(int, input().split())
	loc = set(range(l, r + 1))
	general -= loc
print(len(general))
for item in general:
	print(item, end=' ')


(n, m) = [int(x) for x in input().split()]
l = []
r = []
for i in range(n):
	(a, b) = [int(x) for x in input().split()]
	l.append(a)
	r.append(b)
t = []
s = 0
for i in range(1, m + 1):
	k = 0
	for j in range(n):
		if i > r[j] or i < l[j]:
			k += 1
	if k == len(r):
		s += 1
		t.append(i)
print(s)
for i in range(len(t)):
	print(t[i], end=' ')


(n, u) = map(int, input().split())
l = []
g = [i for i in range(1, u + 1)]
for i in range(n):
	(a, b) = map(int, input().split())
	for i in range(a, b + 1):
		l.append(i)
t = set(l)
m = []
k = 0
for i in g:
	if i not in t:
		k += 1
		m.append(i)
print(k)
for i in m:
	print(i, end=' ')


x = list(map(int, input().split()))
y = []
for c in range(x[0]):
	y.append(list(map(int, input().split())))
bound = []
win = ''
winner = []
for c in range(x[0]):
	for cc in range(y[c][0], y[c][1] + 1):
		bound.append(cc)
for c in range(1, x[1] + 1):
	if c not in bound:
		winner.append(c)
		win = win + str(c) + ' '
print(int(len(winner)))
print(win)


(n, m) = map(int, input().split())
s = [i for i in range(m + 1)]
for _ in range(n):
	(a, b) = map(int, input().split())
	for i in range(a, b + 1):
		s[i] = 0
s = [i for i in s if i]
print(len(s))
print(*s)


from sys import stdin, stdout
input = lambda : stdin.readline().rstrip()
write = stdout.write

def main():
	(N, M) = map(int, input().split())
	LR = [tuple(map(int, input().split())) for _ in [0] * N]
	set1 = set(range(1, M + 1))
	set2 = set()
	for (l, r) in LR:
		for i in range(l, r + 1):
			set2.add(i)
	ans = set1 ^ set2
	print(len(ans))
	print(*ans)
main()


x = [int(i) for i in input().split()]
(n, m, res) = (x[0], x[1], [])
for i in range(n):
	res.append([int(i) for i in input().split()])
maxrange = [i for i in range(1, m + 1)]
for i in res:
	for j in range(1, m + 1):
		if i[0] <= j <= i[1]:
			try:
				maxrange.remove(j)
			except ValueError:
				pass
print(len(maxrange))
print(' '.join([str(i) for i in maxrange]))


(n, m) = input().split()
l = []
f = []
for i in range(1, int(m) + 1):
	l.append(i)
for i in range(0, int(n)):
	(a, b) = input().split()
	for j in range(int(a), int(b) + 1):
		if j not in f:
			f.append(j)
final = set(l) - set(f)
print(len(final))
for i in final:
	print(i, end=' ')


import math
import itertools
getInputList = lambda : list(input().split())
getInputIntList = lambda : list(map(int, input().split()))
(n, m) = getInputIntList()
a = set([])
for i in range(n):
	(d, c) = getInputIntList()
	for j in range(d, c + 1):
		a.add(j)
ans = ''
for i in range(1, m + 1):
	if i not in a:
		ans += str(i) + ' '
print(m - len(a))
print(ans)


from math import *
from collections import *
from itertools import *
from bisect import *
from operator import *
import sys
sys.setrecursionlimit(1000000)

def io():
	return map(int, input().split())

def op():
	return list(map(int, input().split()))

def o():
	return int(input())

def kl(con, x=0):
	if x == 0:
		print('Yes') if con else print('No')
	elif x == 1:
		print('yes') if con else print('no')
	elif x == 2:
		print('YES') if con else print('NO')
MOD = 1000000007
MAX = 2147483647
MIN = -2147483648
p = input
(n, m) = io()
l = []
ans = []
fg = [0] * 101
for _ in range(n):
	(a, b) = io()
	for i in range(a, b + 1):
		fg[i] = 1
for i in range(1, m + 1):
	if fg[i] == 0:
		ans.append(i)
print(len(ans))
print(*ans)


(n, m) = map(int, input().split())
zbior = set()
for _ in range(n):
	(l, r) = map(int, input().split())
	zbior |= {x for x in range(l, r + 1)}
complement = set(range(1, m + 1)) - zbior
print(len(complement))
for x in complement:
	print(x, end=' ')


(n, m) = map(int, input().split())
ls = set([i for i in range(1, m + 1)])
lss = set()
for i in range(n):
	(a, b) = map(int, input().split())
	lss = lss.union(set([i for i in range(a, b + 1)]))
ls = ls - lss
print(len(ls))
print(*ls)


def main():
	import sys
	(n, m) = [int(x) for x in sys.stdin.readline().strip('\n').split(' ')]
	arr = []
	for i in range(0, n):
		tup = tuple((int(x) for x in sys.stdin.readline().strip('\n').split(' ')))
		arr.append(tup)
	ans_count = 0
	ans_arr = []
	for i in range(0, m):
		is_inside = False
		curr_test = i + 1
		for x in arr:
			if x[0] <= curr_test <= x[1]:
				is_inside = True
				break
		if not is_inside:
			ans_count += 1
			ans_arr.append(curr_test)
	print(ans_count)
	print(*ans_arr)
main()


nm = list(map(int, input().split()))
segment = [0 for x in range(nm[1])]
for i in range(nm[0]):
	temp = list(map(int, input().split()))
	segment[temp[0] - 1:temp[1]:1] = [1 for x in range(temp[1] - temp[0] + 1)]
answer = [str(i + 1) for i in range(nm[1]) if segment[i] == 0]
print(len(answer))
print(' '.join(answer))


(n, m) = map(int, input().split())
arr = []
for i in range(n):
	arr1 = list(map(int, input().split()))
	arr.append(arr1)
arrx = []
for i in range(1, m + 1):
	flag = 0
	for j in range(n):
		if i >= arr[j][0] and i <= arr[j][1]:
			flag = 1
			break
	if flag == 0:
		arrx.append(i)
print(len(arrx))
print(*arrx)


(n, m) = map(int, input().split())
segments = []
line = [1 for i in range(0, m + 1)]
for i in range(n):
	segments.append([int(i) for i in input().split()])
for i in segments:
	for j in range(i[0], i[1] + 1):
		line[j] = 0
print(sum(line) - 1)
for i in range(1, m + 1):
	if line[i] == 1:
		print(i, end=' ')


(n, m) = map(int, input().split())
dic1 = {}
dic2 = {}
for i in range(n):
	(l, r) = map(int, input().split())
	for i in range(l, r + 1):
		p = dic1.get(i, 0)
		dic1[i] = p
for i in range(1, m + 1):
	x = dic2.get(i, 0)
	dic2[i] = x
diff = set(dic2) - set(dic1)
print(len(diff))
for i in dic2.keys():
	if i not in dic1.keys():
		print(i, end=' ')


(n, m) = map(int, input().split())
pos = list()
for j in range(n):
	pos.append(list(map(int, input().split())))
ans = list()
for j in range(n):
	for k in range(pos[j][0], pos[j][1] + 1):
		ans.append(k)
new = [x for x in range(1, m + 1)]
final = list()
for x in new:
	if x not in ans:
		final.append(x)
if len(final) > 0:
	print(len(final))
	for x in final:
		print(x, end=' ')
else:
	print(0)
	print()


(n, m) = map(int, input().split())
z = []
x = []
count = 0
for i in range(n):
	(l, r) = map(int, input().split())
	for i in range(l, r + 1):
		z.append(i)
for i in range(1, m + 1):
	if i not in z:
		count += 1
		x.append(i)
print(count)
print(' '.join(map(str, x)))


(n, m) = map(int, input().split())
vec = []
indexesVec = []
for num in range(1, m + 1):
	vec.append(num)

def removeValue(vec, val):
	while val in vec:
		vec.remove(val)
for _ in range(n):
	(l, r) = map(int, input().split())
	for num in range(l, r + 1):
		removeValue(vec, num)
print(len(vec))
for num in vec:
	print(num, end=' ')


(a, b) = map(int, input().split())
ar = [i for i in range(1, b + 1)]
ar1 = []
for _ in range(a):
	(c, d) = map(int, input().split())
	ar1 = [i for i in range(c, d + 1)]
	for i in ar1:
		if i in ar:
			ar.remove(i)
print(len(ar))
print(*ar)


(n, m) = [int(i) for i in input().split()]
lst = []
for i in range(1, m + 1):
	lst.append(i)
for _ in range(0, n):
	(a, b) = [int(i) for i in input().split()]
	for i in range(a, b + 1):
		try:
			lst.remove(i)
		except:
			pass
n = len(lst)
if n > 0:
	print(n)
	for i in lst:
		print(i, end=' ')
	print()
else:
	print(0)


(n, m) = (int(v) for v in input().split())
list1 = []
for i in range(m):
	list1.append(i + 1)
for j in range(n):
	(l, r) = (int(u) for u in input().split())
	for k in range(l, r + 1):
		list1[k - 1] = 0
x = m - list1.count(0)
ans = ''
for t in range(m):
	if list1[t] != 0:
		ans += str(list1[t]) + ' '
	else:
		pass
print(x)
print(ans.rstrip(' '))


(n, m) = map(int, input().split())
a = []
for i in range(n):
	a.append(list(map(int, input().split())))
b = []
for i in range(n):
	for j in range(1):
		for y in range(abs(a[i][0] - a[i][1]) + 1):
			b.append(a[i][0] + y)
c = []
u = 0
for i in range(1, m + 1):
	if i not in b:
		c.append(i)
		u += 1
print(u)
print(*c)


(n, m) = map(int, input().split())
l = list(range(1, m + 1))
for i in range(n):
	(a, b) = map(int, input().split())
	l = [i for i in l if i not in range(a, b + 1)]
print(len(l))
for i in l:
	print(i, end=' ')


(n, m) = map(int, input().split())
sp = []
for i in range(1, m + 1):
	sp.append(i)
for numa in range(n):
	(l, r) = map(int, input().split())
	for tck in range(l, r + 1):
		if tck in sp:
			sp.remove(tck)
print(len(sp))
for x in sp:
	print(x, end=' ')


s = input()
temp = s.split(' ')
n = int(temp[0])
m = int(temp[1])
u = [[0, 0]] * n
v = [0] * m
i = 0
while i < n:
	s = input()
	temp = s.split(' ')
	u[i] = [int(temp[:][0]), int(temp[:][1])]
	i += 1
x = 1
i = 0
k = 0
while x <= m:
	i = 0
	pertence = False
	while i < n and (not pertence):
		if x >= u[i][0] and x <= u[i][1]:
			pertence = True
		i += 1
	if not pertence:
		v[k] = x
		k += 1
	x += 1
print(k)
i = 0
while i < k:
	print(v[i], end=' ')
	i += 1


(n, m) = [int(q) for q in input().split()]
s = set((q for q in range(1, m + 1)))
c = set()
for j in range(n):
	(l, r) = [int(q) for q in input().split()]
	for i in range(l, r + 1):
		c.add(i)
s -= c
print(len(s))
print(*s)


import math
(n, m) = map(int, input().split())
ls = []
for i in range(n):
	(a, b) = map(int, input().split())
	for j in range(a, b + 1):
		ls.append(j)
ans = set(ls)
lk = []
for i in range(1, m + 1):
	lk.append(i)
ans1 = set(lk)
newans = ans1.difference(ans)
print(len(newans))
for i in newans:
	print(i, end=' ')


(n, m) = [int(i) for i in input().strip().split(' ')]
flag = [True for i in range(0, m + 1)]
counting = m
for j in range(n):
	(l, u) = [int(i) for i in input().strip().split(' ')]
	for k in range(l, u + 1):
		if flag[k] == True:
			flag[k] = False
			counting -= 1
print(counting)
for j in range(1, m + 1):
	if flag[j] == True:
		print(j, end=' ')


(n, m) = map(int, input().split())
ll = set()
for _ in range(n):
	(l, r) = map(int, input().split())
	while l <= r:
		ll.add(l)
		l += 1
out_ll = set()
for i in range(1, m + 1):
	if i not in ll:
		out_ll.add(i)
print(len(out_ll))
for i in out_ll:
	print(i, end=' ')
print()


(n, m) = map(int, input().split())
b = {i for i in range(1, m + 1)}
for i in range(n):
	a = {}
	(z, y) = map(int, input().split())
	a = {i for i in range(z, y + 1)}
	b = b - a
print(len(b))
print(*b)


(number, mx) = map(int, input().split())
(dn, dnL) = (0, [])
for i in range(number):
	(l, r) = map(int, input().split())
	for q in range(1, mx + 1):
		if l <= q <= r and q not in dnL:
			(dn, dnL) = (dn + 1, dnL + [q])
if mx - dn == 0:
	print(0)
else:
	print(mx - dn)
	print(*[a for a in range(1, mx + 1) if not a in dnL])


from functools import cmp_to_key

class seg:

	def __init__(self, x, y):
		self.l = x
		self.r = y

	def __str__(self):
		return '[{}, {}]'.format(self.l, self.r)

def mycomp(a, b):
	if a.l > b.l:
		return 1
	elif a.l == b.l:
		return 0
	else:
		return -1
mycomp = cmp_to_key(mycomp)

def merge(arr, n):
	arr.sort(key=mycomp, reverse=True)
	index = 0
	for i in range(n):
		if index != 0 and arr[index - 1].l <= arr[i].r:
			while index != 0 and arr[index - 1].l <= arr[i].r:
				arr[index - 1].r = max(arr[index - 1].r, arr[i].r)
				arr[index - 1].l = min(arr[index - 1].l, arr[i].l)
				index -= 1
		else:
			arr[index] = arr[i]
		index += 1
	ans = []
	for i in range(index):
		ans.append(arr[i])
	return ans
(n, m) = tuple(map(int, input().split()))
arr = []
for i in range(n):
	(x, y) = tuple(map(int, input().split()))
	arr.append(seg(x, y))
ans = merge(arr, n)
cnt = 0
res = []
flg = False
for i in range(1, m + 1):
	for z in ans:
		flg |= i in range(z.l, z.r + 1)
	if not flg:
		cnt += 1
		res.append(i)
	flg = False
print(cnt)
if len(res) > 0:
	for k in res:
		print(k, end=' ')
	print()


(n, m) = [int(x) for x in input().split()]
D = {}
for i in range(n):
	(l, r) = [int(x) for x in input().split()]
	for i in range(l, r + 1):
		if not i in D:
			D[i] = 1
S = []
for i in range(1, m + 1):
	if not i in D:
		S.append(i)
print(len(S))
for i in S:
	print(i, end=' ')


def main():
	(n, m) = [int(x) for x in input().split()]
	q = set(range(1, m + 1))
	for _ in range(n):
		(l, r) = [int(x) for x in input().split()]
		for i in range(l, r + 1):
			if i in q:
				q.remove(i)
	print(len(q))
	print(*list(q), sep=' ')
main()


(n, m) = [int(i) for i in input().split()]
a = [True] * m
for i in range(n):
	(c, d) = map(int, input().split())
	for j in range(c - 1, d):
		a[j] = False
k = 0
b = []
for i in range(m):
	if a[i]:
		k += 1
		b.append(i + 1)
print(k)
print(*b)


(n, m) = map(int, input().split())
t = []
for i in range(n):
	t.append(list(map(int, input().split())))
nb = 0
h = []
for i in range(1, m + 1):
	test = True
	for j in t:
		if i in range(j[0], j[1] + 1):
			test = False
			break
	if test:
		h.append(i)
		nb += 1
print(nb)
for i in h:
	print(i, end=' ')


(n, m) = list(map(int, input().split()))
li = []
for _ in range(n):
	(l, r) = list(map(int, input().split()))
	for n in range(l, r + 1):
		li.append(n)
c = 0
temp = []
for i in range(1, m + 1):
	if i not in li:
		c += 1
		temp.append(i)
print(c)
for i in temp:
	print(i, end=' ')


(A, M) = tuple(map(int, input().split()))
ans = [0 for i in range(M)]
for k in range(A):
	(seg1, seg2) = tuple(map(int, input().split()))
	for t in range(seg1 - 1, seg2):
		ans[t] = 1
An = M - sum(ans)
print(An)
if An != 0:
	for k in range(M):
		if ans[k] == 0:
			print(k + 1, end=' ')


f = lambda : map(int, input().split())
(n, r) = f()
p = []
while n:
	(a, b) = f()
	p.extend(range(a, b + 1))
	n -= 1
p = set(range(1, r + 1)) - set(p)
if len(p):
	print(len(p))
	[print(i, end=' ') for i in p]
else:
	print(0)


(n, m) = list(map(int, input().split()))
all_points = set((i + 1 for i in range(m)))
for j in range(n):
	(left, right) = list(map(int, input().split()))
	all_points = all_points.difference(set((i + 1 for i in range(left - 1, right))))
print(len(all_points))
print(*sorted(all_points))


(n, m) = map(int, input().split())
L = []
ANS = [0] * (m + 1)
for i in range(n):
	l = list(map(int, input().split()))
	L.append(l)
for i in range(n):
	(l, r) = (L[i][0], L[i][1])
	for i in range(l, r + 1):
		ANS[i] = 1
ans = ANS.count(0)
FINAL_ANS = []
if ans == 0:
	print(0)
else:
	print(ans - 1)
	for i in range(1, m + 1):
		if ANS[i] == 0:
			FINAL_ANS.append(i)
	print(*FINAL_ANS)


(n, m) = map(int, input().split())
lst = list(range(1, m + 1))
arr = []
for i in range(n):
	(l, r) = map(int, input().split())
	arr += list(range(l, r + 1))
diff = sorted(set(lst).difference(set(arr)))
print(len(diff))
print(*diff)


def main():
	(n, m) = map(int, input().split())
	r = set()
	(a, b) = (None, None)
	for _ in range(n):
		(a, b) = map(int, input().split())
		r.add(a)
		r.add(b)
		for i in range(a, b + 1):
			r.add(i)
	toprint = []
	for i in range(1, m + 1):
		if i not in r:
			toprint.append(i)
	print(len(toprint))
	print(*toprint)
main()


(n, m) = map(int, input().split())
li = []
for i in range(n):
	(l, r) = map(int, input().split())
	li.append(l)
	li.append(r)
c = 0
li2 = []
f = 0
for j in range(1, m + 1):
	for k in range(0, len(li) - 1, 2):
		if j >= li[k] and j <= li[k + 1]:
			f = 0
			break
		else:
			f = 1
	if f == 1:
		c += 1
		li2.append(j)
print(c)
for s in range(len(li2)):
	print(li2[s], end=' ')


(n, m) = map(int, input().split())
a = []
mn = m + 1
mx = -1
c = set()
for i in range(n):
	a.append([int(e) for e in input().split()])
	for j in range(a[i][0], a[i][1] + 1):
		c.add(j)
c = sorted(c)
q = [int(i) for i in range(1, m + 1)]
res = []
for i in range(len(q)):
	if q[i] not in c:
		res.append(q[i])
print(len(res))
print(*res)


def pointsInSegments(coordinates, m):
	coordinates.sort(key=lambda tup: tup[0])
	curr_segment = 0
	not_belonging = ''
	for curr_num in range(1, m + 1):
		while curr_segment < len(coordinates):
			if coordinates[curr_segment][0] > curr_num:
				not_belonging += str(curr_num) + ' '
				break
			if coordinates[curr_segment][0] <= curr_num and coordinates[curr_segment][1] >= curr_num:
				break
			curr_segment += 1
		if curr_segment >= len(coordinates):
			not_belonging += str(curr_num) + ' '
	if not_belonging == '':
		return '0\n'
	else:
		return str(len(not_belonging.split())) + '\n' + not_belonging
data = input().split()
n = int(data[0])
m = int(data[1])
segments = []
for i in range(n):
	segment = input().split()
	segments.append((int(segment[0]), int(segment[1])))
print(pointsInSegments(segments, m))


import math
(n, m) = input().split()
n = int(n)
m = int(m)
s = 0
a = [0] * m
for i in range(n):
	(l, r) = input().split()
	if int(l) == int(r) and a[int(l) - 1] == 0:
		a[int(l) - 1] = 1
		s += 1
	for j in range(int(l) - 1, int(r)):
		if a[j] == 0:
			a[j] = 1
			s += 1
print(m - s)
if m - s != 0:
	for i in range(m):
		if a[i] == 0:
			print(i + 1, end=' ')


I = lambda : map(int, input().split())
(n, m) = I()
ar = [i for i in range(1, m + 1)]
for i in range(n):
	(a, b) = I()
	for _ in range(a, b + 1):
		try:
			ar.remove(_)
		except:
			continue
print(len(ar))
print(*ar)


(n, m) = map(int, input().split())
dic = {}
for x in range(m):
	dic[x + 1] = 0
for _ in range(0, n):
	(x, y) = map(int, input().split())
	for i in range(x, y + 1):
		if i in dic:
			del dic[i]
print(len(dic))
print(' '.join((str(y) for y in dic.keys())))


(n, m) = [int(x) for x in input().split(' ')]
points_lst = []
for i in range(n):
	points = [int(y) for y in input().split(' ')]
	for a in range(points[0], points[1] + 1):
		points_lst.append(a)
points_final = set(points_lst)
points_excluded = [z for z in range(1, m + 1) if z not in points_final]
print(len(points_excluded))
print(*points_excluded)


(n, m) = map(int, input().split())
count = 0
lst = []
d = {}
for i in range(1, m + 1):
	d[i] = 0
for _ in range(n):
	(l, r) = map(int, input().split())
	for i in range(l, r + 1):
		d[i] = 1
for i in d:
	if d[i] == 0:
		count += 1
		lst.append(i)
print(count)
for i in lst:
	print(i, end=' ')


(n, m) = map(int, input().split())
line = [0] * 102
for _ in range(n):
	(a, b) = map(int, input().split())
	line[a] += 1
	line[b + 1] -= 1
ans = 0
p = []
runsum = 0
i = 1
while i <= m:
	runsum += line[i]
	if runsum == 0:
		ans += 1
		p.append(i)
	i += 1
print(ans)
if ans > 0:
	print(' '.join(map(str, p)))


(n, m) = [int(i) for i in input().split()]
ls = [[0] for i in range(0, m + 1)]
for i in range(n):
	(j, k) = [int(i) for i in input().split()]
	for l in range(j, k + 1):
		ls[l][0] = 1
count = 0
res = []
for j in range(1, len(ls)):
	if ls[j][0] == 0:
		count += 1
		res.append(j)
print(count)
if count:
	print(*res, end=' ')


l = list(map(int, input().split()))
I = []
for i in range(l[0]):
	k = list(map(int, input().split()))
	I.append(k)

def segment(l):
	return [int(i) for i in range(l[0], l[1] + 1)]

def count_absent_point(l, I):
	main = []
	count_absent = 0
	absent_num = []
	for i in I:
		for j in segment(i):
			main.append(j)
	Set = set(main)
	for i in range(1, l[1] + 1):
		if i not in Set:
			count_absent += 1
			absent_num.append(i)
	if count_absent != 0:
		print(count_absent)
		print(' '.join([str(x) for x in absent_num]))
	else:
		print(0)
count_absent_point(l, I)


def Points():
	(n, m) = list(map(int, input().split()))
	nums = []
	for i in range(n):
		(l, r) = list(map(int, input().split()))
		nums.extend(range(l, r + 1))
	nums.sort()
	t = 0
	nums2 = []
	for i in range(1, m + 1):
		if i not in nums:
			t += 1
			nums2.append(i)
	print(t)
	print(' '.join((str(j) for j in nums2)))
Points()


(n, m) = map(int, input().split())
ml = []
count = 0
for i in range(1, m + 1):
	ml.append(i)
lo = []
for i in range(n):
	(l, r) = map(int, input().split())
	for j in range(l, r + 1):
		lo.append(j)
	ml = [i for i in ml if i not in lo]
print(len(ml))
print(*ml)


a = input().split()
p = set(range(1, int(a[1]) + 1))
for i in range(int(a[0])):
	a = input().split()
	p -= set(range(int(a[0]), int(a[1]) + 1))
p = [str(i) for i in p]
print(len(p))
print(' '.join(p))


def checkPoints(n, m, segments):
	res = [x for x in range(1, m + 1)]
	for index in segments:
		temp = [z for z in range(index[0], index[1] + 1)]
		res = set(res) - set(temp)
	print(len(res))
	print(*res)
(n, m) = map(int, input().split(' '))
segments = [[int(x) for x in input().split(' ')] for _ in range(n)]
checkPoints(n, m, segments)


(n, m) = map(int, input().split())
A = [0] * m
for i in range(n):
	(l, r) = map(int, input().split())
	(l, r) = (l - 1, r - 1)
	A[l:r + 1] = [1] * (r - l + 1)
cnt = 0
ones = []
for i in range(m):
	if A[i] == 0:
		cnt += 1
		ones.append(i + 1)
print(cnt)
for i in range(cnt):
	print(ones[i], end='')
	if i < cnt - 1:
		print(' ', end='')


(n, m) = map(int, input().split())
l1 = [0] * (m + 1)
for i in range(n):
	(l, r) = map(int, input().split())
	bounds = (l, r)
	l1[bounds[0]:bounds[1] + 1] = [1] * (bounds[1] + 1 - bounds[0])
l1 = l1[1:]
print(m - l1.count(1))
if m - l1.count(1) == 0:
	exit(0)
else:
	for i in range(len(l1)):
		if l1[i] == 0:
			print(i + 1, end=' ')


(n, k) = list(map(int, input().split()))
c = []
f = 0
e = []
d = 0
for i in range(n):
	(a, b) = list(map(int, input().split()))
	for i in range(a, b + 1):
		if i not in c:
			c.append(i)
for j in range(1, k + 1):
	if j not in c:
		d += 1
		e.append(j)
		f = 1
if f == 0:
	print(0)
else:
	print(d)
	e = ' '.join((str(i) for i in e))
	print(e)


(n, m) = map(int, input().split())
arr = []
for _ in range(n):
	arr.append(list(map(int, input().split())))
count = 0
result = []
for x in range(1, m + 1):
	flag = True
	for y in arr:
		if x >= y[0] and x <= y[1]:
			flag = False
			break
	if flag:
		count += 1
		result.append(x)
print(count)
for x in result:
	print(x, end=' ')


result = []
data = []
(number, m) = map(int, input().split())
for a in range(number):
	(b, c) = map(int, input().split())
	for d in range(b, c + 1):
		data.append(d)
data = set(data)
for a in range(1, m + 1):
	if a not in data:
		result.append(a)
if len(result) > 0:
	print(len(result))
	for e in result:
		print(e, end=' ')
else:
	print(0)


(n, m) = map(int, input().split())
c = set()
for i in range(1, m + 1):
	c.add(i)
for i in range(n):
	(l, r) = map(int, input().split())
	for v in range(l, r + 1):
		if v in c:
			c.remove(v)
print(len(c))
for i in c:
	print(i, end=' ')


input_line = input().split(' ')
(num_of_seg, upp_bound) = [int(i) for i in input_line]
seg_bounds = []
for i in range(num_of_seg):
	input_line = input().split(' ')
	input_line = [int(i) for i in input_line]
	seg_bounds.append(input_line)
output = []
for i in range(1, upp_bound + 1):
	flag = 1
	for (li, ri) in seg_bounds:
		if i >= li and i <= ri:
			flag = 0
	if flag:
		output.append(i)
if len(output):
	print(len(output))
	print(' '.join((str(el) for el in output)))
else:
	print(0)


(n, m) = map(int, input().split())
a = [0] * m
for i in range(n):
	(p1, p2) = map(int, input().split())
	for j in range(p1 - 1, p2):
		a[j] = 1
b = []
for i in range(len(a)):
	if a[i] == 0:
		b.append(i + 1)
if len(b) > 0:
	print(len(b))
	print(*b)
else:
	print(0)


(n, m) = map(int, input().split())
set1 = set()
set2 = set([i for i in range(1, m + 1)])
for i in range(n):
	(l, r) = map(int, input().split())
	for j in range(l, r + 1):
		set1.add(j)
array = list(set2 - set1)
print(len(array))
print(' '.join((str(s) for s in array)))


(n, m) = map(int, input().split())
x = []
d = []
while n:
	(a, b) = map(int, input().split())
	c = [x.append(i) for i in range(a, b + 1)]
	n -= 1
x.sort()
y = [i for i in range(1, m + 1)]
for i in y:
	if i not in x:
		d.append(i)
print(len(d))
if len(d) > 0:
	print(*d)


(n, m) = map(int, input().split())
s = set()
for _ in range(n):
	(l, r) = map(int, input().split())
	for i in range(l, r + 1):
		s.add(i)
x = m - len(s)
print(x)
if x > 0:
	for i in range(1, m + 1):
		if i not in s:
			print(i, end=' ')
	print()


(n, m) = [int(i) for i in input().split()]
potential = [0 for i in range(m + 1)]
potential[0] = 1
for i in range(n):
	(l, r) = [int(i) for i in input().split()]
	for j in range(l, r + 1):
		potential[j] = 1
ans = [j for j in range(m + 1) if potential[j] == 0]
print(len(ans))
for i in ans:
	print(i, end=' ')


(n, ub) = list(map(int, input().split()))
k = []
for _ in range(n):
	l = list(map(int, input().split()))
	k += range(l[0], l[1] + 1)
c = 0
p = []
for i in range(1, ub + 1):
	if i not in k:
		p += [i]
		c += 1
print(c)
if c != 0:
	for i in p:
		print(i, end=' ')


from sys import stdin, stdout
import bisect
from bisect import bisect_left as bl
from bisect import bisect_right as br
import itertools
from collections import Counter
import collections
import math
import heapq
import re

def modinv(n, p):
	return pow(n, p - 2, p)

def cin():
	return map(int, sin().split())

def ain():
	return list(map(int, sin().split()))

def sin():
	return input()

def inin():
	return int(input())

def Divisors(n):
	l = []
	for i in range(1, int(math.sqrt(n) + 1)):
		if n % i == 0:
			if n // i == i:
				l.append(i)
			else:
				l.append(i)
				l.append(n // i)
	return l

def most_frequent(list):
	return max(set(list), key=list.count)

def GCD(x, y):
	while y:
		(x, y) = (y, x % y)
	return x

def ncr(n, r, p):
	t = fact[n] * (ifact[r] * ifact[n - r] % p) % p
	return t

def Convert(string):
	li = list(string.split(''))
	return li

def SieveOfEratosthenes(n):
	global prime
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	f = []
	for p in range(2, n):
		if prime[p]:
			f.append(p)
	return f
prime = []
q = []

def dfs(n, d, v, c):
	global q
	v[n] = 1
	x = d[n]
	q.append(n)
	j = c
	for i in x:
		if i not in v:
			f = dfs(i, d, v, c + 1)
			j = max(j, f)
	return j

def main():
	(n, m) = map(int, input().split())
	a = [0] * m
	for i in range(n):
		(l, r) = map(int, input().split())
		for j in range(l, r + 1):
			a[j - 1] = -1
	temp = a.count(0)
	print(temp)
	if temp != 0:
		for i in range(m):
			if a[i] == 0:
				print(i + 1, end=' ')
		print('')
py2 = round(0.5)
if py2:
	from future_builtins import ascii, filter, hex, map, oct, zip
	range = xrange
import os, sys
from io import IOBase, BytesIO
BUFSIZE = 8192

class FastIO(BytesIO):
	newlines = 0

	def __init__(self, file):
		self._file = file
		self._fd = file.fileno()
		self.writable = 'x' in file.mode or 'w' in file.mode
		self.write = super(FastIO, self).write if self.writable else None

	def _fill(self):
		s = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
		self.seek((self.tell(), self.seek(0, 2), super(FastIO, self).write(s))[0])
		return s

	def read(self):
		while self._fill():
			pass
		return super(FastIO, self).read()

	def readline(self):
		while self.newlines == 0:
			s = self._fill()
			self.newlines = s.count(b'\n') + (not s)
		self.newlines -= 1
		return super(FastIO, self).readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.getvalue())
			(self.truncate(0), self.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		if py2:
			self.write = self.buffer.write
			self.read = self.buffer.read
			self.readline = self.buffer.readline
		else:
			self.write = lambda s: self.buffer.write(s.encode('ascii'))
			self.read = lambda : self.buffer.read().decode('ascii')
			self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


(n, m) = [int(s) for s in input().split()]
taken = set()
for i in range(n):
	(l, r) = [int(s) for s in input().split()]
	for j in range(l, r + 1):
		taken.add(j)
print(m - len(taken))
for i in range(1, m + 1):
	if i not in taken:
		print(i, end=' ')


nm = list(map(int, input().split()))
numbers = []
spaces = 0
spaces_numbers = []
for i in range(nm[0]):
	k = list(map(int, input().split()))
	for j in range(k[0], k[1] + 1):
		if j not in numbers:
			numbers.append(j)
for m in range(1, nm[1] + 1):
	if m not in numbers:
		spaces += 1
		spaces_numbers.append(m)
print(spaces)
print(*spaces_numbers)


(n, k) = map(int, input().split())
a = []
x = set(list(range(1, k + 1)))
y = set()
for i in range(n):
	(u, v) = tuple(map(int, input().split()))
	y.update(list(range(u, v + 1)))
ans = list(x - y)
print(len(ans))
print(*ans)


(n, m) = map(int, input().split())
p = []
for i in range(n):
	p.append(list(map(int, input().split())))
q = []
for (i, j) in p:
	for i in range(i, j + 1):
		q.append(i)
q = list(set(q))
w = []
for i in range(1, m + 1):
	if i in q:
		continue
	else:
		w.append(i)
print(len(w))
for i in w:
	print(i, end=' ')


(n, m) = input().strip().split(' ')
(n, m) = [int(n), int(m)]
c = [0] * (m + 1)
c[0] = -1
while n:
	(l, r) = input().strip().split(' ')
	(l, r) = [int(l), int(r)]
	for x in range(l, r + 1):
		c[x] = 1
	n -= 1
ans = 0
for x in range(1, m + 1):
	if c[x] == 0:
		ans += 1
print(ans)
for x in range(1, m + 1):
	if c[x] == 0:
		print(x, end=' ')


n_m = input().split()
n = int(n_m[0])
m = int(n_m[1])
every_point = [*range(1, m + 1)]
for i in range(n):
	l_r = input().split()
	l = int(l_r[0])
	r = int(l_r[1])
	check_point = [*range(l, r + 1)]
	for point in check_point:
		try:
			every_point.remove(point)
		except ValueError:
			pass
print(len(every_point))
every_point = [str(every_point[w]) for w in range(len(every_point))]
every_point = ' '.join(every_point)
print(every_point)


(n, m) = map(int, input().split())
lst1 = []
for i in range(1, m + 1):
	lst1.append(i)
lst2 = []
for i in range(n):
	(l, r) = map(int, input().split())
	for j in range(l, r + 1):
		lst2.append(j)
lst3 = list(set(lst1) - set(lst2))
print(len(lst3))
print(*lst3)


(n, m) = map(int, input().split())
l = [0] * (m + 1)
r = [0] * (m + 1)
ans = []
for i in range(n):
	(x, y) = map(int, input().split())
	l[x] += 1
	r[y] += 1
s = 0
for i in range(1, m + 1):
	s += l[i]
	if s == 0:
		ans.append(i)
	s -= r[i]
print(len(ans))
print(*ans)


(n, m) = map(int, input().split())
a = [0] * (m + 1)
for i in range(n):
	(l, r) = map(int, input().split())
	for i in range(l, r + 1):
		a[i] = 1
a2 = []
c = 0
for i in range(1, m + 1):
	if a[i] != 1:
		c += 1
		a2.append(i)
print(c)
if c != 0:
	print(*a2)


(n, m) = map(int, input().split())
D = {}
for i in range(n):
	(u, v) = map(int, input().split())
	for i in range(u, v + 1):
		D[i] = 1
List = []
num = 0
for i in range(1, m + 1):
	if i not in D:
		List.append(i)
		num += 1
if num:
	print(num)
	for i in List:
		print(i, end=' ')
else:
	print(0)


(n, m) = map(int, input().split())
ml = list([True] * m)
for i in range(n):
	(l, r) = map(int, input().split())
	for j in range(l, r + 1):
		ml[j - 1] = False
res = 0
points = list()
for i in range(m):
	if ml[i] == True:
		res += 1
		points.append(i + 1)
print(res)
if res > 0:
	res1 = ''
	for i in range(0, res - 1):
		res1 += str(points[i]) + ' '
	res1 += str(points[res - 1])
	print(res1)


import sys
input_str = sys.stdin.readlines()
n = int(input_str[0].split()[0])
m = int(input_str[0].split()[1])
points = [i for i in range(1, m + 1)]
for i in range(1, n + 1):
	x = int(input_str[i].split()[0])
	y = int(input_str[i].split()[1])
	for j in range(x, y + 1):
		try:
			points.remove(j)
		except:
			pass
if len(points) == 0:
	print(0)
else:
	print(len(points))
	print(' '.join([str(i) for i in points]))


import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, random, time, copy, functools
sys.setrecursionlimit(10 ** 7)
inf = 10 ** 20
eps = 1.0 / 10 ** 10
mod = 10 ** 9 + 7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]

def LI():
	return [int(x) for x in sys.stdin.readline().split()]

def LI_():
	return [int(x) - 1 for x in sys.stdin.readline().split()]

def LF():
	return [float(x) for x in sys.stdin.readline().split()]

def LS():
	return sys.stdin.readline().split()

def I():
	return int(sys.stdin.readline())

def F():
	return float(sys.stdin.readline())

def S():
	return input()

def pf(s):
	return print(s, flush=True)

def main():
	(n, m) = LI()
	aa = [LI_() for _ in range(n)]
	a = [0] * (m + 1)
	for (c, d) in aa:
		a[c] += 1
		a[d + 1] -= 1
	r = []
	t = 0
	for i in range(m):
		t += a[i]
		if t == 0:
			r.append(i + 1)
	return '{}\n{}'.format(len(r), ' '.join(map(str, r)))
print(main())


params = list(map(int, input().split()))
n = params[0]
m = params[1]
values = {}
for i in range(1, m + 1):
	values[i] = True
for i in range(0, n):
	points = list(map(int, input().split()))
	for j in range(points[0], points[1] + 1):
		values.pop(j, None)
print(len(values))
print(' '.join(map(str, values.keys())))


(n, m) = map(int, input().split())
p = list()
c = int(0)
s = ''
for i in range(m):
	p.append(1)
for i in range(n):
	(l, r) = map(int, input().split())
	for j in range(l - 1, r, 1):
		p[j] = 0
for i in range(m):
	if p[i] == 1:
		c += 1
		s += str(i + 1) + ' '
print(c)
print(s)


(n, m) = tuple(map(int, input().split()))
all_points = set(range(1, m + 1))
for _ in range(n):
	(l, r) = tuple(map(int, input().split()))
	all_points -= set(range(l, r + 1))
print(len(all_points))
print(' '.join(map(str, all_points)))


(n, m) = map(int, input().split())
seg = []
output = []
for i in range(n):
	seg.append(list(map(int, input().split())))
for i in range(1, m + 1):
	blngs = False
	for s in seg:
		if i <= s[1] and i >= s[0]:
			blngs = True
			break
	if not blngs:
		output.append(i)
print(len(output))
for i in output:
	print(i, end=' ')


class calculate:
	pass

def calcu(obj):
	l = [-1] * obj.m
	for i in range(obj.n):
		(a, b) = map(int, input().split())
		for j in range(a - 1, b):
			l[j] = 1
	print(l.count(-1))
	for i in range(obj.m):
		if l[i] == -1:
			print(i + 1, end=' ')
obj = calculate()
(obj.n, obj.m) = map(int, input().split())
calcu(obj)


(n, m) = map(int, input().split())
a = list(range(1, m + 1))
for i in range(n):
	(L, R) = map(int, input().split())
	for j in range(L, R + 1):
		if j in a:
			a.remove(j)
print(len(a))
print(*a)


I = lambda : list(map(int, input().split()))
(n, m) = I()
a = []
for i in range(n):
	a.append(I())
b = []
for i in range(1, m + 1):
	f = True
	for j in a:
		if j[0] <= i <= j[1]:
			f = False
			break
	if f:
		b.append(i)
print(len(b))
print(*b)


p = []
m = []
l = []
n = list(map(int, input().split()))
for i in range(n[0]):
	p = list(map(int, input().split()))
	for j in range(p[0], p[1] + 1):
		m.append(j)
for i in range(1, n[1] + 1):
	l.append(i)
print(len(set(l) - set(m)))
print(*set(l) - set(m))


from sys import stdin, stdout
(n, m) = stdin.readline().split()
(n, m) = (int(n), int(m))
arr = []
for x in range(n):
	(a, b) = stdin.readline().split()
	arr.append((int(a), int(b)))
arr = sorted(arr, key=lambda x: x[0])
x = 1
i = 0
count = 0
ans = []
while x <= m and i < n:
	if x >= arr[i][0] and x <= arr[i][1]:
		x += 1
	elif x > arr[i][1]:
		i += 1
	else:
		count += 1
		ans.append(x)
		x += 1
for x in range(x, m + 1):
	count += 1
	ans.append(x)
print(count)
for i in range(len(ans)):
	print(ans[i], end=' ')


(n, x) = map(int, input().split())
k = [i for i in range(1, x + 1)]
for i in range(n):
	(x1, x2) = map(int, input().split())
	for i in range(x1, x2 + 1):
		if i in k:
			k.remove(i)
k = [str(i) for i in k]
print(len(k))
print(' '.join(k))


def sol():
	(n, m) = list(map(int, input().split()))
	arr = [False] * m
	for i in range(n):
		(l, r) = list(map(int, input().split()))
		for g in range(l - 1, r):
			arr[g] = True
	out = []
	for i in range(m):
		if not arr[i]:
			out.append(i + 1)
	print(len(out))
	print(*out)
sol()


config = input()
values = config.split()
qtd = int(values[0])
m = int(values[1])
segments = []
for i in range(qtd):
	segments.append(input().split())
points = []
for i in range(1, m + 1):
	state = True
	for segment in segments:
		l1 = int(segment[0])
		r1 = int(segment[1])
		if i >= l1 and i <= r1:
			state = False
	if state:
		points.append(i)
print(len(points))
if len(points) > 0:
	string = ''
	for point in points:
		string += str(point) + ' '
	print(string)


(a, b) = map(int, input().split())
l1 = [i for i in range(1, b + 1)]
for i in [0] * a:
	(z, x) = map(int, input().split())
	for c in range(z, x + 1):
		if c in l1:
			l1.remove(c)
print(len(l1))
print(*l1)


(n, m) = map(int, input().split())
dots = []
count = 0
line = [True] * m
for i in range(n):
	(l, r) = map(int, input().split())
	for j in range(l - 1, r):
		line[j] = False
	if l == r:
		line[l - 1] = False
for i in range(m):
	if line[i]:
		count += 1
		dots.append(i + 1)
print(count)
for i in range(len(dots)):
	print(dots[i], end=' ')


x = list(map(int, input().split()))
arr = []
for i in range(x[0]):
	arr.append(list(map(int, input().split())))
ar = []
for i in range(x[0]):
	ar.append(list(range(arr[i][0], arr[i][1] + 1)))
sg = []
for i in range(x[0]):
	sg = sg + ar[i]
c = 0
sg.sort()
gm = []
for i in range(1, x[1] + 1):
	if i in sg:
		c = c
	else:
		gm.append(i)
print(len(gm))
print(*gm, sep=' ')


(a, b) = map(int, input().split())
m = [1 for i in range(b)]
for i in range(a):
	(c, d) = map(int, input().split())
	for j in range(c - 1, d):
		m[j] = 0
print(sum(m))
print(' '.join([str(i + 1) for i in range(b) if m[i] == 1]))


(n, m) = map(int, input().split())
valid_point = [1 for _ in range(1, m + 1)]
for _ in range(n):
	(l, r) = map(int, input().split())
	for x in range(l, r + 1):
		valid_point[x - 1] = 0
print(sum(valid_point))
print(' '.join([str(x + 1) for (x, valid) in enumerate(valid_point) if valid]))


(t, k) = input().split()
li = []
for i in range(int(t)):
	(a, b) = input().split()
	li += [j for j in range(int(a), int(b) + 1)]
print(int(k) - len(set(li)))
li = sorted(set(li))
if int(k) - len(set(li)) != 0:
	for i in range(1, int(k) + 1):
		if i not in li:
			print(i, end=' ')


(n, m) = map(int, input().split())
s = lambda a, b: set(range(a, b + 1))
v = s(1, m)
for _ in range(n):
	v -= s(*map(int, input().split()))
print(len(v))
print(' '.join(map(str, v)))


(n, m) = map(int, input().split())
a = []
for i in range(n):
	a.append(list(map(int, input().split())))
p = []
for i in range(1, m + 1):
	f = 0
	for [x, y] in a:
		if x <= i and i <= y:
			f = 1
			break
	if f == 0:
		p.append(i)
print(len(p))
print(*p)


(n, max) = map(int, input().split())
mylist = list()
for i in range(max):
	mylist.append(i + 1)
for i in range(n):
	(start, end) = map(int, input().split())
	for j in range(start, end + 1):
		if j in mylist:
			mylist.remove(j)
print(len(mylist))
print(*mylist)


(a, b) = map(int, input().split())
p = []
for _ in range(a):
	(c, d) = map(int, input().split())
	while c <= d:
		p.append(c)
		c = c + 1
q = []
x = int(1)
while x <= b:
	if x not in p:
		q.append(x)
	x = x + 1
print(len(q))
if len(q) != 0:
	print(*q)


(n, m) = map(int, input().split())
w = []
b = []
for i in range(1, m + 1):
	w.append(i)
w = set(w)
for i in range(0, n):
	(l1, l2) = map(int, input().split())
	w -= set(range(l1, l2 + 1))
print(len(w))
print(*w)


(n, hi) = [int(i) for i in input().split()]
s = set([i for i in range(1, hi + 1)])
for _ in range(n):
	(l, r) = [int(i) for i in input().split()]
	for i in range(l, r + 1):
		s.discard(i)
print(len(s))
print(*list(s))


from operator import itemgetter
segments = []
(n, m) = list(map(int, input().split(' ')))
for i in range(n):
	(t1, t2) = list(map(int, input().split(' ')))
	segments += [[t1, t2]]
notin = []
for x in range(1, m + 1):
	b = True
	for s in segments:
		if x >= s[0] and x <= s[1]:
			b = False
	if b:
		notin += [x]
print(len(notin))
string = ''
if len(notin) == 0:
	print()
elif len(notin) == 1:
	print(notin[0])
else:
	for i in range(len(notin) - 1):
		string += str(notin[i]) + ' '
	string += str(notin[len(notin) - 1])
	print(string)


(n, m) = map(int, input().split())
arr = [False] * (m + 1)
for i in range(n):
	(a, b) = map(int, input().split())
	for i in range(a, b + 1):
		arr[i] = True
print(m - sum(arr))
for i in range(1, m + 1):
	if not arr[i]:
		print(i, end=' ')


(n, m) = map(int, input().split())
(t, tp) = ([], [])
for i in range(m):
	t.append(i + 1)
for i in range(n):
	(b, r) = map(int, input().split())
	for j in range(b - 1, r):
		t[j] = 0
k = 0
for i in range(m):
	if t[i] > 0:
		tp.append(i + 1)
		k += 1
print(k)
print(' '.join([str(i) for i in tp]))


(n, m) = map(int, input().split(' '))
a = []
b = []
c = []
d = 0
for i in range(n):
	(l, r) = map(int, input().split(' '))
	a.append(l)
	b.append(r)
for i in range(1, m + 1):
	d = 0
	for j in range(n):
		if a[j] <= i <= b[j]:
			d = 1
			pass
	if d == 0:
		c.append(i)
if len(c) == 0:
	print(0)
	print()
else:
	print(len(c))
	for i in c:
		print(i, end=' ')


a = []
(n, m) = map(int, input().split())
for x in range(n):
	(l, r) = map(int, input().split())
	if l == r:
		a.append(l)
	else:
		for x in range(l, r + 1):
			a.append(x)
s = set(a)
b = list(s)
c = []
for x in range(1, m + 1):
	if x not in b:
		c.append(x)
if c == []:
	print('0')
else:
	print(len(c))
	for x in range(len(c)):
		print(c[x], end=' ')


(n, m) = [int(a) for a in input().split()]
segments = []
for _ in range(n):
	(l, r) = [int(a) for a in input().split()]
	segments.append((l, r))
bad = []
for i in range(1, m + 1):
	inASegment = False
	for (l, r) in segments:
		if l <= i and i <= r:
			inASegment = True
			break
	if not inASegment:
		bad.append(i)
print(len(bad))
if bad:
	print(' '.join([str(a) for a in bad]))


import sys
import math
fileoperation = 0
if fileoperation:
	orig_stdout = sys.stdout
	orig_stdin = sys.stdin
	inputfile = open('W:/Competitive Programming/input.txt', 'r')
	outputfile = open('W:/Competitive Programming/output.txt', 'w')
	sys.stdin = inputfile
	sys.stdout = outputfile
mod = 1000000007

def nospace(l):
	ans = ''.join((str(i) for i in l))
	return ans
(n, m) = map(int, sys.stdin.readline().split(' '))
check = [0 for i in range(m)]
for _ in range(n):
	(a, b) = map(int, sys.stdin.readline().split(' '))
	a -= 1
	b -= 1
	for i in range(a, b + 1):
		check[i] = 1
ans = []
print(check.count(0))
for i in range(m):
	if check[i] == 0:
		ans.append(i + 1)
print(*ans)
if fileoperation:
	sys.stdout = orig_stdout
	sys.stdin = orig_stdin
	inputfile.close()
	outputfile.close()


def main():
	(n, m) = map(int, input().strip().split())
	segs = [[int(x) for x in input().strip().split()] for _ in range(n)]
	aux = [0] * (m + 1)
	for (s, e) in segs:
		for x in range(s, e + 1):
			aux[x] = 1
	ans = []
	for (i, x) in enumerate(aux[1:], start=1):
		if x == 0:
			ans.append(i)
	print(len(ans))
	print(*ans)
main()


(n, m) = list(map(int, input().split()))
s = set()
a = []
for __ in range(n):
	(x, y) = list(map(int, input().split()))
	for i in range(x, y + 1):
		s.add(i)
cnt = 0
for i in range(1, m + 1):
	if i not in s:
		a.append(i)
		cnt += 1
print(cnt)
print(*a)


(n, m) = map(int, input().split())
k = 0
x = [0] * m
y = []
for i in range(n):
	(l, r) = map(int, input().split())
	for j in range(l - 1, r):
		x[j] += 1
for z in range(len(x)):
	if x[z] == 0:
		k += 1
		y.append(z + 1)
print(k)
if len(y) > 0:
	for j in y:
		print(j, end=' ')


import re
import sys
exit = sys.exit
from bisect import bisect_left as bsl, bisect_right as bsr
from collections import Counter, defaultdict as ddict, deque
from functools import lru_cache
cache = lru_cache(None)
from heapq import *
from itertools import *
from math import inf
from pprint import pprint as pp
enum = enumerate
ri = lambda : int(rln())
ris = lambda : list(map(int, rfs()))
rln = sys.stdin.readline
rl = lambda : rln().rstrip('\n')
rfs = lambda : rln().split()
mod = 1000000007
d4 = [(0, -1), (1, 0), (0, 1), (-1, 0)]
d8 = [(-1, -1), (0, -1), (1, -1), (-1, 0), (1, 0), (-1, 1), (0, 1), (1, 1)]
(n, m) = ris()
a = [0] * (m + 2)
for _ in range(n):
	(l, r) = ris()
	a[l] += 1
	a[r + 1] -= 1
ans = []
for i in range(1, m + 1):
	a[i] += a[i - 1]
	if a[i] == 0:
		ans.append(i)
print(len(ans))
print(*ans)


(a, b) = map(int, input().split())
s = set([i for i in range(1, b + 1)])
e = set()
for _ in range(a):
	(c, d) = map(int, input().split())
	e = e.union([i for i in range(c, d + 1)])
print(len(s.difference(e)))
print(*s.difference(e))