def check(mid, arr, max_moves):
    count = 0
    for num in arr:
        if num % mid == 0:
            count += num // mid
        else:
            count += num // mid + 1
            
    return max_moves >= count

def solve(arr, max_moves):
    low = 1
    high = max(arr)
    ans = -1
    
    while low <= high:
        mid = (low + high) // 2
        
        if check(mid, arr, max_moves):
            ans = mid
            high = mid - 1
        else:
            low = mid + 1
            
    return ans