program d
implicit none

integer :: i, n, m, x
integer,dimension(1) :: y
integer(8),allocatable,dimension(:) :: a

read(*,*) n, m

allocate(a(n))

read(*,*) a

do i = 1, m
x = maxval(a)
y = maxloc(a)
x = int(x/2)
a(y(1)) = x
end do

write(*,'(i0)') sum(a)

end program