program kadai
implicit none
integer(8)  ::  n,m
integer(8),allocatable  ::  a(:)
integer(8)  ::  loc,i,j

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

call qsort(a)

do i=1,m
    j=1
    do
        if (j==n) then
            a(j)=a(j)/2
            exit
        end if
        if (a(j)>a(j+1)) then
            a(j)=a(j)/2
            exit
        end if
        j=j+1
    end do
end do

write(*,*) sum(a)

stop
contains

subroutine swap(a,b)
    implicit none
    integer(8),intent(inout)  ::  a,b
    integer(8)  ::  c
    c=a
    a=b
    b=c
end subroutine swap

subroutine qsort(x)
    implicit none
    integer(8), intent(inout)  ::  x(:)
    integer(8)  ::  first,last
    first=1
    last=size(x)
    call q2sort(x,first,last)
    return
end subroutine qsort

recursive subroutine q2sort(x,first,last)
    implicit none
    integer(8), intent(inout)  ::  x(:)
    integer(8), intent(inout) ::  first,last
    integer(8)  ::  fir, las
    integer(8)  ::  i,j
    integer(8)  ::  n
    n=x((first+last)/2)
    i=first
    j=last
    do
    do while (x(i)<n)
    i=i+1
    end do
    do while(x(j)>n)
    j=j-1
    end do
    if (i>j .or. i==j) then
    exit
    end if
    call swap(x(i),x(j))
    i=i+1
    j=j-1
    end do
    if (first<i-1) then
    las=i-1
    call q2sort(x,first,las)
    end if
    if (last>j+1) then
    fir=j+1
    call q2sort(x,fir,last)
    end if
end subroutine q2sort
end program kadai