The ZCO scholarship contest offers scholarships to first time ZCO participants. You are participating in it for the first time. So you want to know the number of participants who'll get the scholarship.
You know that the maximum number of scholarships offered is $R$ and there are a total of $N$ participants numbered from $1$ to $N$. Out of these, you know the set of people (denoted by $X$) who you know, had participated in previous year ZCOs and hence, they shall not get the scholarship.
Further, as the world isn't free from plagiarism, so is the case with the scholarship contest. And from your secret sources, you also know the set of people (denoted by set $Y$) who were involved in plagiarism and therefore aren't eligible for scholarship either.
Find out the number of participants who shall get the scholarship.
PS: Don't ask how so many scholarships are being offered when you see the constraints on $R$. You never questioned it when in mathematics classes, some person bought $80$ watermelons twice just to compare them and save $₹1$. 

-----Input:-----
- The first line will contain a single integer, $T$, the number of testcases. Then the testcases follow. 
- The first line of each test case contains four integers; $N$, $R$, $|X|$ and $|Y|$ denoting the number of participants, maximum number of scholarships offered, number of old participants, and the number of participants involved in plagiarism, respectively.
- The second line of each test case contains $|X|$ space separated integers $x_1, x_2 \ldots x_{|X|}$ denoting the indices of people who participated in previous years. If $X$ is empty, this line is skipped and no empty line is in the input.
- The third line of each test case contains $|Y|$ space separated integers $y_1, y_2 \ldots y_{|Y|}$  denoting the indices of people who are involved in plagiarism. If $Y$ is empty, this line is skipped and no empty line is in input.

-----Output:-----
For each testcase, print a single integer in a new line, denoting the number of participants who shall get the scholarship.

-----Constraints-----
- $1 \leq T \leq 1000$
- $1 \leq N \leq 10^{15}$
- $0 \leq R \leq 10^{15}$
- $0 \leq |X|, |Y| \leq min(N, 2*10^5)$
- $1 \leq x_i, y_i \leq N$
- All $x_i$ are distinct
- All $y_i$ are distinct
- Sum of $|X|$ over all test cases does not exceed $5*10^5$
- Sum of $|Y|$ over all test cases does not exceed $5*10^5$

-----Subtasks-----
- 20 points : $1 \leq N \leq 10^3$, and the sum of $N$ over all test cases does not exceed $3*10^3$
- 30 points : $1 \leq N \leq 2*10^5$, and the sum of $N$ over all test cases does not exceed $5*10^5$
- 50 points: Original constraints

-----Sample Input:-----
3
5 3 0 1
4
10 2 4 6
3 1 7 6
4 3 1 5 9 7
10 4 4 6
3 1 7 6
4 3 1 5 9 7

-----Sample Output:-----
3
2
3

-----EXPLANATION:-----
- In the first testcase, only participant $4$ is involved in plagiarism, and thus not eligible for the scholarship. No user has participated in previous years, and so no empty line is there in the sample. All participants except participant $4$ are eligible for the scholarship, but only three of them get it because $R = 3$.
- Both second and third testcases are the same, except for $R$. In both samples, only participants $2$, $8$ and $10$ are eligible for scholarships.
- In the second testcase, since the maximum number of scholarships is $2$, only $2$ participants get scholarships.
- In the third testcase, all three eligible participants get scholarships.

Difficulty: interview

Starter code:

Solutions:
for _ in range(int(input())):
 n,r,x,y=map(int,input().split())
 if x>0:
  a=list(map(int,input().split()))
 if y>0:
  b=list(map(int,input().split()))
 if x>0 and y>0:
  a=a+b
  c=n-len(list(set(a)))
 else:
  l=x+y
  c=n-l
 x=min(c,r)
 print(x)

t = int(input())
for _ in range(t):
 xi, yi = [], []
 n, r, x, y = list(map(int, input().split()))
 if x > 0:
  xi = list(map(int, input().split()))
 if y > 0:
  yi = list(map(int, input().split()))
 part_cheat = {}
 for i in range(max(x, y)):
  if x > i:
   if xi[i] not in part_cheat:
    part_cheat[xi[i]] = True
  if y > i:
   if yi[i] not in part_cheat:
    part_cheat[yi[i]] = True
 cheaters = len(part_cheat)
 total = n - cheaters
 print(min(total, r))


for _ in range(int(input())):
 count = 0
 nc = 0
 arr1 = []
 arr2 = []
 n, r, x, y = list(map(int, input().split()))
 if x != 0:
  arr1 = list(map(int, input().split()))
 if y != 0:
  arr2 = list(map(int, input().split()))
 zz = len(set(arr1).union(set(arr2)))
 n -= zz
 if n >= r:
  print(r)
 else:
  print(n)

for _ in range(int(input())):
 n,r,x,y=map(int,input().split())
 if x>0:
  arr=set(list(map(int,input().split())))
 if y>0:
  brr=set(list(map(int,input().split())))
 if x>0 and y>0:
  crr=list(arr.union(brr))
  t=n-len(crr)
  if t>r:
   print(r)
  else:
   print(t)
 elif x>0 or y>0:
  s=max(x,y)
  t=n-s
  if t>r :
   print(r)
  else:
   print(t)
 else:
  if n>r:
   print(r)
  else:
   print(n)

from sys import stdin
input=stdin.readline
for _ in range(int(input())):
 n,r,x,y=map(int,input().split())
 if x!=0:
  prev_yrs=list(map(int,input().split()))
 else:
  prev_yrs=[]
 if y!=0:
  plgrsm=list(map(int,input().split()))
 else:
  plgrsm=[]
 prev_yrs.extend(plgrsm)
 non_elig=len(set(prev_yrs))
 elig_scholar=n-non_elig
 if elig_scholar>r:
  print(r)
 else:
  print(elig_scholar)

from sys import stdin
input=stdin.readline
for _ in range(int(input())):
 n,r,x,y=list(map(int,input().split()))
 if x!=0:
  prev_yrs=list(map(int,input().split()))
 else:
  prev_yrs=[]
 if y!=0:
  plgrsm=list(map(int,input().split()))
 else:
  plgrsm=[]
 prev_yrs.extend(plgrsm)
 non_elig=len(set(prev_yrs))
 elig_scholar=n-non_elig
 if elig_scholar>r:
  print(r)
 else:
  print(elig_scholar)
 
    
   
  


# cook your dish here
# cook your dish here
# cook your dish here
t=int(input())
for z in range(t):
 n,r,x,y=map(int,input().split())
 if x!=0 and y!=0:
  lx=set(map(int,input().split()))
  ly=set(map(int,input().split()))
 elif x==0 and y!=0:
  ly=set(map(int,input().split()))
 elif x!=0 and y==0:
  lx=set(map(int,input().split()))
 if x==0 and y==0:
  if n<=r:
   print(n)
  else:
   print(r)
 elif(x==0 and y!=0):
  if (n-y)<=r:
   print(n-y)
  else:
   print(r)
 elif(x!=0 and y==0):
  if (n-x)<=r:
   print(n-x)
  else:
   print(r)
 else:
  p=len(lx.union(ly))
  if (n-p)<=r:
   print(n-p)
  else:
   print(r)

# cook your dish here
# cook your dish here
# cook your dish here
t=int(input())
for z in range(t):
 n,r,x,y=map(int,input().split())
 if x!=0 and y!=0:
  lx=set(map(int,input().split()))
  ly=set(map(int,input().split()))
 elif x==0 and y!=0:
  ly=set(map(int,input().split()))
 elif x!=0 and y==0:
  lx=set(map(int,input().split()))
 if x==0 and y==0:
  if n<=r:
   print(n)
  else:
   print(r)
 elif(x==0 and y!=0):
  if (n-y)<=r:
   print(n-y)
  else:
   print(r)
 elif(x!=0 and y==0):
  if (n-x)<=r:
   print(n-x)
  else:
   print(r)
 else:
  p=len(lx.union(ly))
  if (n-p)<=r:
   print(n-p)
  else:
   print(r)

t=int(input())
for z in range(t):
 n,r,x,y=map(int,input().split())
 if x!=0 and y!=0:
  lx=set(map(int,input().split()))
  ly=set(map(int,input().split()))
 elif x==0 and y!=0:
  ly=set(map(int,input().split()))
 elif x!=0 and y==0:
  lx=set(map(int,input().split()))
 if x==0 and y==0:
  if n<=r:
   print(n)
  else:
   print(r)
 elif(x==0 and y!=0):
  if (n-y)<=r:
   print(n-y)
  else:
   print(r)
 elif(x!=0 and y==0):
  if (n-x)<=r:
   print(n-x)
  else:
   print(r)
 else:
  p=len(lx.union(ly))
  if (n-p)<=r:
   print(n-p)
  else:
   print(r)

# cook your dish here
# cook your dish here
t=int(input())
for z in range(t):
 n,r,x,y=map(int,input().split())
 if x!=0 and y!=0:
  lx=set(map(int,input().split()))
  ly=set(map(int,input().split()))
 elif x==0 and y!=0:
  ly=set(map(int,input().split()))
 elif x!=0 and y==0:
  lx=set(map(int,input().split()))
 if x==0 and y==0:
  if n<=r:
   print(n)
  else:
   print(r)
 elif(x==0 and y!=0):
  if (n-y)<=r:
   print(n-y)
  else:
   print(r)
 elif(x!=0 and y==0):
  if (n-x)<=r:
   print(n-x)
  else:
   print(r)
 else:
  p=len(lx.union(ly))
  if (n-p)<=r:
   print(n-p)
  else:
   print(r)

# cook your dish here
t = int(input())
for i in range(t):
 n,r,x,y = list(map(int,input().strip().split(' ')))
 X = []
 Y = []
 if x!=0:
  X = list(map(int,input().strip().split(' ')))
 if y!=0:
  Y = list(map(int,input().strip().split(' ')))
 X.extend(Y)
 X = set(X)
 l = n - len(X)
 if r<l:
  print(r)
 else:
  print(l)

# cook your dish here
for i in range(int(input())):
 n,r,x,y=map(int,input().split())
 if x==1:
  xli=[int(input())]
 if x>1:
  xli=list(map(int,input().split()))
 elif x==0:
  xli=[]
 if y>1:
  yli=list(map(int,input().split()))
 elif y==1:
  yli=[int(input())]
 elif y==0:
  yli=[]
 ree=n-len(list(set(xli+yli)))
 if ree>r:
  print(r)
 else:
  print(ree)

# cook your dish here
T = int(input())
for t in range(T):
 s = input().split(' ')
 n = int(s[0])
 r = int(s[1])
 x = int(s[2])
 y = int(s[3])
 X = []
 Y = []
 if(x>0):
  s = input().split(' ')
 for i in range(x):
  X.append(int(s[i]))
 if(y>0):
  s = input().split(' ')
 for i in range(y):
  Y.append(int(s[i]))

 X = set(X)
 Y = set(Y)

 z = n - len(X.union(Y))
 if(z>=r):
  print(r)
 else:
  print(z)

ans=[]
for i in range(int(input())):
 n, r, x, y = list(map(int, input().split()))
 if x>0:
  x=list(map(int, input().split()))
 else:
  x=[]
 if y>0:
  x+=list(map(int, input().split()))
 x=list(set(x))
 ans.append(min(n-len(x), r))
for i in ans:
 print(i)


ans=[]
for i in range(int(input())):
 n, r, x, y = list(map(int, input().split()))
 n=list(range(1, n+1))
 if x>0:
  x=list(map(int, input().split()))
 else:
  x=[]
 if y>0:
  x+=list(map(int, input().split()))
 x=list(set(x))
 ans.append(min(len(n)-len(x), r))
for i in ans:
 print(i)


# cook your dish here
t=int(input())
for _ in range(t):

 n,r,nx,ny=list(map(int,input().split()))
 if nx>0:
  x=set(map(int,input().split()))
 else:
  x=set()
 if ny>0:
  y=set(map(int,input().split()))
 else:
  y=set()

 common=len(set.intersection(x,y))

 genuine_c=n-nx-ny+common

 if genuine_c>r:
  print(r)
 else:
  print(genuine_c)


test=int(input())
for loop in range(test):
 flag=0
 (sch,ele,inele)=(0,0,0)
 xl=[]
 yl=[]
 (n,r,x,y)=map(int,input().split())
 if x>0:
  xindex=input().split()
  for q in range(x):
   xl.append(int(xindex[q]))
 if y>0:
  yindex=input().split()
  for p in range(y):
   yl.append(int(yindex[p]))
 try:
  for a in xl:
   if a in yl:
    flag+=1
 except NameError:
  flag=0
 sch=x+y-(2*flag)
 inele=sch+flag
 ele=n-inele
 print(min(ele,r))

t= int(input())
while t>0:
 t -= 1
 preplayers =[]
 plagplayers= []
 n, r, x, y = map(int, input().split(' '))
 if x:
  preplayers=[int(x) for x in input().split(' ')]
 if y:
  plagplayers=[int(x) for x in input().split(' ')]
 final = len(set(plagplayers).union(set(preplayers)))
 allow = n-final
 if allow > r:
  print(r)
 else:
  print(allow)

t=int(input())
for _ in range(t):

 n,r,nx,ny=list(map(int,input().split()))
 if nx>0:
  x=set(map(int,input().split()))
#        x=list(range(500000))
 else:
  x=set()
 if ny>0:
  y=set(map(int,input().split()))
#        y=list(range(1000000))
 else:
  y=set()

 common=len(set.intersection(x,y))

 genuine_c=n-nx-ny+common

 if genuine_c>r:
  print(r)
 else:
  print(genuine_c)


t=int(input())
for _ in range(t):

 n,r,nx,ny=list(map(int,input().split()))
 if nx>0:
  x=set(map(int,input().split()))
 else:
  x=set()
 if ny>0:
  y=set(map(int,input().split()))
 else:
  y=set()

 common=len(set.intersection(x,y))

 genuine_c=n-nx-ny+common

 if genuine_c>r:
  print(r)
 else:
  print(genuine_c)


for _ in range(int(input())):
 n, r, x, y = [int(x) for x in input().split()]
 repeat = []
 plagis = []
 if x > 0:repeat = [int(x) for x in input().split()]
 if y > 0:plagis = [int(x) for x in input().split()]
 invalid = set(repeat).union(set(plagis))
 print(min(r, n - len(invalid)))

# cook your dish here

a = int(input())
while a!=0:
 b,c,d,e = map(int,input().split())
 mylist1 = list()
 mylist2 = list()
 if d>0:
  mylist1 = list(map(int,input().split()))
 if e>0:
  mylist2 = list(map(int,input().split()))
 mylist2.extend(mylist1)
 list1= list(set(mylist2))
 
 if b-len(list1)>=c:
  print(c)
 else:
  print( b-len(list1))


 a-=1

# cook your dish here
for t in range(int(input())):
 n,r,x,y=map(int,input().split())
 lx=ly=set()
 if x:
  lx=set(map(int,input().split()))
 if y:
  ly=set(map(int,input().split()))
 F=lx.union(ly)
 if n-len(F)>=r:
  print(r)
 else:
  print(n-len(F))