N,m,*A = `dd`.split.map &:to_i
while m > 0 do
  A.sort_by!{ |a| -a }
  msb = nil
  A.each_with_index{ |a,i|
    msb ||= 1 << (a.bit_length-1)
    if (msb & a) == msb
      A[i] /= 2
      m -= 1
    end
    break if m == 0
  }
end

p A.reduce(0,:+)