#C11632. Minimum Days to Read Required Words

    ID: 40970 Type: Default 1000ms 256MiB

Minimum Days to Read Required Words

Minimum Days to Read Required Words

Alex has a collection of novels. Each novel contains a certain number of words. Alex wants to achieve at least a total of M words read by selecting a subset of these novels. However, he wants to minimize the number of days he spends reading. He reads one novel per day, so the problem is to choose the smallest number of novels such that the sum of their word counts is at least M . Formally, given a list of word counts \( w_1, w_2, \ldots, w_N \), find the smallest number \( k \) such that

[ \sum_{i=1}^{k} w_i \ge M ]

If it is impossible to reach at least M words, output "Impossible".

Input/Output: The input is read from standard input and the output should be printed to standard output. See the input and output sections below for more details.

inputFormat

The first line of input contains an integer T, the number of test cases. For each test case:

  • The first line contains two space-separated integers: N (the number of novels) and M (the target number of words to read).
  • The second line contains N space-separated integers, where each integer represents the number of words in a novel.

You need to process each test case independently.

outputFormat

For each test case, print on a new line the minimum number of days required to accumulate at least M words. If it is not possible to accumulate M words, print "Impossible".

## sample
1
3 15
5 7 8
2

</p>