#K78062. Sum of Elements Greater than K
Sum of Elements Greater than K
Sum of Elements Greater than K
Given an array of ( n ) integers and an integer ( k ), compute the sum of all elements in the array that are greater than ( k ). In other words, calculate
[ S = \sum_{a_i > k} a_i, ]
where ( a_i ) represents each element of the array. The input will be provided via standard input and the result should be printed to standard output.
inputFormat
The first line contains two integers ( n ) and ( k ), where ( n ) is the number of elements in the array and ( k ) is the threshold value. The second line contains ( n ) space-separated integers representing the elements of the array.
outputFormat
Output a single integer representing the sum of all the elements in the array that are greater than ( k ).## sample
6 3
1 4 2 7 5 3
16
</p>