Mahesh kumar lodhi also called as MKL by his friends is a contestant of roadies .He has successfully pulled off 5 rounds but to get in semifinals he has to complete one more task which is termed as "CRAB VS FROG" ..... The task is simple there are P stations build serially each has two box one containing crab and another frog . Each contestant is provided with a basket containing some crab initially .One has to move from one station to another but that costs him one crab , every time a contestant has to pick either a crab or a frog in each station. Each station has different number of crabs and frogs. MKL is allowed to take only either all frogs or all crabs and not none or both.The contestant having maximum number of frogs wins... By following this rule, what is the maximum number of frogs MKL can collect, always having number of crabs greater than or equal to zero? Remember the crabs are dangerous and could bite the trick is to calm and composed.. Initially MKL is at starting point, and to move to the first station it shall cost him one crab.
Input :
First line of each test file contains a single integer T denoting number of test case. Each test case contains three lines.
First line contains two space separated integers P and E denoting total number of stations and number of crabs MKL initially has.
Second line contains P space separated integers, where the ith integer is Crabs[i] and denotes the total number of crabs MKL can gain by taking crabs from the ith station.
Third line contains P space separated integers, where the ith integer is Frogs[i] and denotes the total number of frogs MKL can gain by taking frog from the ith station if he will not take crab from that station.
Output : For each test case answer in new line maximum number of frogs MKL can collect.
Constraints :
1 ≤ T ≤ 100
1 ≤ P ≤ 1000
0 ≤ E ≤ 1018
0 ≤ Crabs[i] ≤ 1000
0 ≤Frogs[i] ≤ 1000