title: More efficient method of finding minimum sum after k operations
body: <p>An array is manipulated k times so that each time the max value is devided by 2 and rounded up.
  I need to find its minimum sum after these k manipulations.
  k and all numbers in array num > 1.
  The method minSum recieves an array called num and an integer k.
  The brute Python code that works for me with very bad time complexity is:</p>
  
  <pre><code>import bisect
  
  def minSum(num, k):
      num.sort()
      lastIndex = len(num)-1
      for i in range(k):
          if num[lastIndex]==1:
              return sum(num)
  
          num[lastIndex]= math.ceil(num[lastIndex]/2)
          lastNumber = num[len(num)-1]
          num.pop()
          bisect.insort(num, lastNumber)
  
      return sum(num)
  </code></pre>
  
  <p>I've also tried to sort the array first but then every algorithm I tried failed.
  could you think of a good algorithm with good time complexity? preferably without using special imports.</p>