#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int dp[3601][2];
int main()
{
	int k;
	cin >> k;
	for (int j = 0; j < k; ++j)
	{
		int n;
		cin >> n;
		int t;
		cin >> t;
		vector<int> arr(n);
		for (int i = 0; i < n; ++i)
		{
			cin >> arr[i];
		}
		for (int i = 0; i <= 3600; ++i)
		{
			dp[i][0] = dp[i][1] = -1;
		}
		dp[0][0] = 0;
		int cur = 1, prev = 0;
		int ans = 1e9, c = 0, cnt = 1;
		for (int q = 0; q < 500; ++q)
		{
			for (int i = 0; i <= 3600; ++i)
			{
				for (int i1 = 0; i1 < n; ++i1)
				{
					int s = min(i + arr[i1], 3600);
					if (dp[i][prev] != -1 && s >= 0 && s <= 3600)
					{
						dp[s][cur] = 1;
						//cout << cnt << " " << s << endl;
						//system ("pause");
						if (t <= s && ans - t > s - t)
						{
							ans = s;
							c = cnt;
						}
					}
				}
			}
			swap(cur, prev);
			++cnt;
		}
		cout << c << " " <<  ans - t  << endl;
	}
	return 0;
}