Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import sys
- import math
- input = sys.stdin.readline
- for _ in range(int(input())):
- n, k = [int(i) for i in input().split()]
- a = [int(i) for i in input().split()]
- max_ = max(a)
- mex_ = [int(i) for i in range(n) if i not in a]
- if len(mex_) > 0:
- res = min(mex_)
- else:
- res = 0
- ans = int(math.ceil(max_ + res) / 2)
- for i in range(k):
- a.append(ans)
- print(len(set(a)))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement