2025-02-06 12:17:03 -06:00

41 lines
766 B
Python

def main():
test_cases = int(input())
while (test_cases != 0):
n, k = [int(n) for n in input().split()]
boxes: list[int] = [int(candies) for candies in input().split()]
boxes.sort(reverse=True)
# k = 2
# [4, 3, 1]
i = 0
l = len(boxes)
largest = boxes[i]
while largest > 0:
correct = 0
for candies in boxes:
if (c := candies // largest) > 0:
correct += c
if correct >= k:
break
i += 1
if i >= l:
largest = 0
break
largest = boxes[i]
print(largest)
test_cases -= 1
if __name__ == "__main__":
main()