18.22m
import sys
input = sys.stdin.readline
na, nb = list(map(int, input().rstrip().split()))
a = list(map(int, input().rstrip().split()))
b = sorted(list(map(int, input().rstrip().split())))
res = []
def bin_search(target):
start = 0
end = nb - 1
while start <= end:
mid = (start + end) // 2
if b[mid] == target:
return False
elif b[mid] > target:
end = mid - 1
elif b[mid] < target:
start = mid + 1
return True
for target in a:
if bin_search(target):
res.append(target)
print(len(res))
if res: print(*sorted(res), sep=' ')
실버 이분탐색은 착하네요...
근데 마지막에 정렬해서 출력해야하는거 못봐서 두번이나 틀렸따... 짜증