program main
    implicit none
    integer::i,j,k, p1, p2, wari
    integer:: n,m
    integer(8),allocatable:: a(:)
    integer(8):: v1, v2

    read*, n,m
    allocate(a(n))
    read*, a(1:n)

    do while(m > 0)
        p1 = maxloc(a(1:n),1)
        v1 = a(p1)
        a(p1) = 0
        p2 = maxloc(a(1:n),1)
        v2 = a(p2)

        ! print*, '#2',a
        wari = 0
        do while(v1 >= v2)
            v2 = v2*2
            wari = wari + 1
        end do
        a(p1) = v1 / 2**wari
        ! print*, "#3", a


        m = m - 1
    end do
    
  
    print*, sum(a)

    
end program