Finally, Little Q gets his weapon at level 10^5 in the RPG game, now he is trying to beat the boss as soon as possible. The boss has H units of health point (HP), Little Q needs to cause at least H units of damage to beat the boss.
Little Q has learnt n skills, labeled by 1,2,…,n. Each skill can not be used multiple times, because there is not enough time for Little Q to wait for the skill to cool down. Assume Little Q uses the ith skill at the x-th fr
The game starts at the 00-th fr
The first line contains a single integer T(1≤T≤100), the number of test cases. For each test case:
The first line contains two integers n and H (1≤n≤18, 1≤H≤1018), denoting the number of skills and the HP of the boss.
For each skill, the first line contains two integers ti and leni (1≤ti,leni≤100,000), the second line contains leni integers di,0,di,1,…,di,leni−1 (1≤di,j≤109).
It is guaranteed that the sum of all eni is at most 3,000,000, and there are at most 5 cases such that n>10.
3
1 100
5 3
50 60 70
2 100
2 3
40 40 100
100 2
20 5
1 1000
1 1
999
1
2
-1