Intelligent cattle raising
题号:NC245512
时间限制:C/C++/Rust/Pascal 2秒,其他语言4秒
空间限制:C/C++/Rust/Pascal 32 M,其他语言64 M
64bit IO Format: %lld

题目描述

Happy Farm has many cows. Each cow can eat at least M jin of grass a day to be full. Happy Farm has an intelligent cattle raising plan: that is, if a cow gets grass in one day, the weight of grass must be the same as that of other cows, and it must be able to eat enough. Today, Happy Farm has been send N clumps of grass with different weights. As each clump of grass is delivered to cows by intelligent sorting equipment, it cannot be separated, and only one clump of grass can be delivered to a cow. Happy Farm wants to know : how many jins of grass each cow gets when the N clumps of grass is distributed to as many cows as possible. Can you help Happy Farm complete this task?

输入描述:

The first line is a positive integer T (1≤T≤10), indicating that there are T test cases.

Each test case has two lines. In the first line, there are two positive integers M (1≤M≤65) and N (1≤N≤65). M represents the weight of grass that cows need to eat every day at least, and N represents the presence of N clumps of grass; The next row contains N positive integers (each positive integer≤65), representing the weight of each clumps of grass.

输出描述:

The output of each test case occupies one line, which is a positive integer, indicating the weight of grass that can be allocated to the largest number of cows, and these cows can eat enough today.

示例1

输入

复制
2
6 8
5 2 1 5 1 5 1 4
4 5
1 2 3 4 5

输出

复制
6
5