Roy is the owner of a flower plant farm and sells flower plants for a living. 
Now the problem with flower plants is that they wither in a night if not taken care of. So at the end of the day, to make flower plants wither-resistant Roy uses special fertilizers.  

There are N number of plants not sold on one particular day (say today), but Roy can sell them the next day (say tomorrow) if he fertilizes them tonight. 
Roy sells a flower plant for Rs. X. Cost of fertilizing a plant is Rs. Y. 
Currently Roy has P Rupees with him.

Given the selling price X and fertilizing cost Y of N plants, your task is to find minimum amount A (A ≤ P) that he should spend in fertilizing plants such that the total money he has after selling plants on the next day is maximized. Assume that all the fertilized plants are sold on the next day.  

Input Format:
First line contains integer T - number of test cases.
Second line contains two space separated integers N and P.
Following N lines each contain two space separated integers X and Y.  

Output Format:
Print the two space separated integers A and B in a new line for each test case.  

Constraints:
1 ≤ T ≤ 10
1 ≤ N ≤ 100
1 ≤ X,Y ≤ 1000 
1 ≤ P ≤ 10000  

SAMPLE INPUT
2
2 50
80 40
60 20
5 100
100 40
50 40
40 50
60 20
100 50

SAMPLE OUTPUT
20 90
90 210

Explanation

Test Case #1:
He has Rs. 50 with him in the beginning. To fertilize both the plants he needs Rs. 60. So he has to choose one of them. Now profit from both the plants is equal i.e Rs. 40. But the cost of fertilizing second plant is less. Hence the Minimum Amount to spend is Rs. 20 and total money he has after selling the plants is 50 - 20 + 60 = 90

Test Case #2:
Profit for each of the plants is 60, 10, -10, 40, 50 respectively. He has Rs. 100 with him. The optimal selection would be fertilize first and last plant. So Minimum Amount to spend is Rs. 90 and total money he has after selling the plants is 100 - 40 - 50 + 100 + 100 =210
def computeDP(totalPlants,lastDaysProfit,fertilizers,profit):

	# First we find what maximum profit Roy could gain
	dp = [[0 for x in xrange(lastDaysProfit+1)] for x in xrange(totalPlants+1)]
	for i in xrange(totalPlants+1):
		for j in xrange(lastDaysProfit+1):
			if i == 0 or j == 0:
				dp[i][j] = 0
			elif fertilizers[i-1] <= j:
				dp[i][j] = max(profit[i-1] + dp[i-1][j-fertilizers[i-1]], dp[i-1][j], dp[i][j-1])
			else:
				dp[i][j] = max(dp[i-1][j],dp[i][j-1])
	maxProfit = dp[totalPlants][lastDaysProfit]

	# Now we find the minimum amount he should spend in order to get maximum profit
	i = totalPlants
	j = lastDaysProfit
	while j >= 0 and maxProfit == dp[i][j]:
		j -= 1
	j += 1
	return [j,maxProfit+lastDaysProfit]

def roy_and_flolastDaysProfiter_plant():
	for t in xrange(input()):
		fertilizers = []
		profit = []
		n,p = map(int,raw_input().split())
		for i in xrange(n):
			x,y = map(int,raw_input().split())
			fertilizers.append(y)
			profit.append(x-y)
		res = computeDP(n,p,fertilizers,profit)
		print res[0],res[1]
roy_and_flolastDaysProfiter_plant()