#C11943. Minimum Array Value after Operations
Minimum Array Value after Operations
Minimum Array Value after Operations
You are given an array and an integer K representing the maximum number of operations allowed. The array has N elements where the elements are denoted by \(A = [A_1, A_2, \dots, A_N]\). Even though up to \(K\) operations can be performed, the nature of the operation is such that the minimum value of the array will never be increased. Your task is to determine the minimum element in the array.
Note: The operations allowed do not affect the minimum value present. Essentially, your job is to find \(\min\{A_1, A_2, \dots, A_N\}\).
inputFormat
The input is given via stdin and consists of two lines:
- The first line contains two integers \(N\) and \(K\), where \(N\) is the number of elements in the array and \(K\) is the maximum number of operations allowed.
- The second line contains \(N\) integers separated by spaces representing the array elements \(A_1, A_2, \dots, A_N\).
outputFormat
Output a single integer to stdout: the minimum value of the array after applying at most \(K\) operations.
## sample5 3
1 5 7 8 9
1