#K74107. Find the Smallest Divisor
Find the Smallest Divisor
Find the Smallest Divisor
You are given an array of n positive integers and a positive integer threshold. Your task is to find the smallest positive integer divisor \( d \) such that when each element in the array is divided by \( d \) and the result is rounded up to the nearest integer, the sum of these results is less than or equal to the threshold.
Formally, given the array \( nums \) and threshold \( t \), you need to find the minimum \( d \) such that:
[ \sum_{i=1}^{n} \left\lceil \frac{nums[i]}{d} \right\rceil \leq t ]
It is guaranteed that such a divisor exists.
inputFormat
The first line of input contains two integers \( n \) and \( t \) (the threshold), where \( n \) is the number of elements in the array.
The second line contains \( n \) space-separated positive integers representing the elements of the array.
outputFormat
Output a single integer, which is the smallest divisor \( d \) that satisfies the condition.
## sample4 6
1 2 5 9
5