import sys
input=sys.stdin.readline

N,M = (int(x) for x in input().rstrip('\n').split())
As = [int(x) for x in input().rstrip('\n').split()]
As = sorted(As,reverse = True)
rest = M
for _ in range(M):
  if rest == 0:
    break
  d = As[0]
  b = d//2 - d//4
  for i in range(N):
    a = As[i]
    check = 0
    if a-a//2<b:
      if rest > i:
        ad = [x//2 for x in As[:i]]
        As = As[i:]
        As.extend(ad)
        rest -= i
        check += 1
        As = sorted(As,reverse = True)
        break
      else:
        ad = [x//2 for x in As[:rest]]
        As = As[rest:]
        As.extend(ad)
        check += 1
        rest = 0
        break
    if i == N-1:
      if check == 0:
        if rest > N:
          As = [x//2 for x in As]
          rest -= N
        else:
          ad = [x//2 for x in As[:rest]]
          As = As[rest:]
          As.extend(ad)
          rest = 0
          break
print(sum(As)) import sys sys input=sys.stdin.readline input sys.stdin.readline sys.stdin sys stdin readline int(x) for x in input().rstrip('\n').split() for x in input().rstrip('\n').split() x input().rstrip('\n').split() ().rstrip('\n').split ().rstrip('\n') ().rstrip () input rstrip '\n' split for x in input().rstrip('\n').split() int(x) int x N,M = (int(x) for x in input().rstrip('\n').split()) N (int(x) for x in input().rstrip('\n').split()) M int(x) for x in input().rstrip('\n').split() for x in input().rstrip('\n').split() x input().rstrip('\n').split() ().rstrip('\n').split ().rstrip('\n') ().rstrip () input rstrip '\n' split for x in input().rstrip('\n').split() int(x) int x As = [int(x) for x in input().rstrip('\n').split()] As [int(x) for x in input().rstrip('\n').split()] As = sorted(As,reverse = True) As sorted(As,reverse = True) sorted As reverse = True reverse True rest = M rest M for _ in range(M):
  if rest == 0:
    break
  d = As[0]
  b = d//2 - d//4
  for i in range(N):
    a = As[i]
    check = 0
    if a-a//2<b:
      if rest > i:
        ad = [x//2 for x in As[:i]]
        As = As[i:]
        As.extend(ad)
        rest -= i
        check += 1
        As = sorted(As,reverse = True)
        break
      else:
        ad = [x//2 for x in As[:rest]]
        As = As[rest:]
        As.extend(ad)
        check += 1
        rest = 0
        break
    if i == N-1:
      if check == 0:
        if rest > N:
          As = [x//2 for x in As]
          rest -= N
        else:
          ad = [x//2 for x in As[:rest]]
          As = As[rest:]
          As.extend(ad)
          rest = 0
          break _ range(M) range M if rest == 0:
    break
   rest == 0 rest 0 break d = As[0] d As[0] As 0 b = d//2 - d//4 b d//2 - d//4 d//2 d 2 d//4 d 4 for i in range(N):
    a = As[i]
    check = 0
    if a-a//2<b:
      if rest > i:
        ad = [x//2 for x in As[:i]]
        As = As[i:]
        As.extend(ad)
        rest -= i
        check += 1
        As = sorted(As,reverse = True)
        break
      else:
        ad = [x//2 for x in As[:rest]]
        As = As[rest:]
        As.extend(ad)
        check += 1
        rest = 0
        break
    if i == N-1:
      if check == 0:
        if rest > N:
          As = [x//2 for x in As]
          rest -= N
        else:
          ad = [x//2 for x in As[:rest]]
          As = As[rest:]
          As.extend(ad)
          rest = 0
          break i range(N) range N a = As[i] a As[i] As i check = 0 check 0 if a-a//2<b:
      if rest > i:
        ad = [x//2 for x in As[:i]]
        As = As[i:]
        As.extend(ad)
        rest -= i
        check += 1
        As = sorted(As,reverse = True)
        break
      else:
        ad = [x//2 for x in As[:rest]]
        As = As[rest:]
        As.extend(ad)
        check += 1
        rest = 0
        break
     a-a//2<b a-a//2 a a//2 a 2 b if rest > i:
        ad = [x//2 for x in As[:i]]
        As = As[i:]
        As.extend(ad)
        rest -= i
        check += 1
        As = sorted(As,reverse = True)
        break
      else:
        ad = [x//2 for x in As[:rest]]
        As = As[rest:]
        As.extend(ad)
        check += 1
        rest = 0
        break
     rest > i rest i x//2 for x in As[:i] for x in As[:i] x As[:i] As :i i for x in As[:i] x//2 x 2 ad = [x//2 for x in As[:i]] ad [x//2 for x in As[:i]] As = As[i:] As As[i:] As i: i As.extend(ad) As.extend As extend ad rest -= i rest i check += 1 check 1 As = sorted(As,reverse = True) As sorted(As,reverse = True) sorted As reverse = True reverse True break x//2 for x in As[:rest] for x in As[:rest] x As[:rest] As :rest rest for x in As[:rest] x//2 x 2 ad = [x//2 for x in As[:rest]] ad [x//2 for x in As[:rest]] As = As[rest:] As As[rest:] As rest: rest As.extend(ad) As.extend As extend ad check += 1 check 1 rest = 0 rest 0 break if i == N-1:
      if check == 0:
        if rest > N:
          As = [x//2 for x in As]
          rest -= N
        else:
          ad = [x//2 for x in As[:rest]]
          As = As[rest:]
          As.extend(ad)
          rest = 0
          break i == N-1 i N-1 N 1 if check == 0:
        if rest > N:
          As = [x//2 for x in As]
          rest -= N
        else:
          ad = [x//2 for x in As[:rest]]
          As = As[rest:]
          As.extend(ad)
          rest = 0
          break check == 0 check 0 if rest > N:
          As = [x//2 for x in As]
          rest -= N
        else:
          ad = [x//2 for x in As[:rest]]
          As = As[rest:]
          As.extend(ad)
          rest = 0
          break rest > N rest N x//2 for x in As for x in As x As for x in As x//2 x 2 As = [x//2 for x in As] As [x//2 for x in As] rest -= N rest N x//2 for x in As[:rest] for x in As[:rest] x As[:rest] As :rest rest for x in As[:rest] x//2 x 2 ad = [x//2 for x in As[:rest]] ad [x//2 for x in As[:rest]] As = As[rest:] As As[rest:] As rest: rest As.extend(ad) As.extend As extend ad rest = 0 rest 0 break print(sum(As)) print sum(As) sum As As = As[rest:] As[rest:] As rest -= i i rest As = sorted(As,reverse = True) sorted(As,reverse = True) As As = As[rest:] As[rest:] As rest = 0 0 rest As = sorted(As,reverse = True) sorted(As,reverse = True) As rest = M M rest rest = 0 0 rest N,M = (int(x) for x in input().rstrip('\n').split()) (int(x) for x in input().rstrip('\n').split()) N input=sys.stdin.readline sys.stdin.readline input a = As[i] As[i] a check = 0 0 check ad = [x//2 for x in As[:rest]] [x//2 for x in As[:rest]] ad As = As[i:] As[i:] As ad = [x//2 for x in As[:i]] [x//2 for x in As[:i]] ad As = [int(x) for x in input().rstrip('\n').split()] [int(x) for x in input().rstrip('\n').split()] As rest -= N N rest check += 1 1 check ad = [x//2 for x in As[:rest]] [x//2 for x in As[:rest]] ad M = (int(x) for x in input().rstrip('\n').split()) (int(x) for x in input().rstrip('\n').split()) M check += 1 1 check As = [x//2 for x in As] [x//2 for x in As] As d = As[0] As[0] d b = d//2 - d//4 d//2 - d//4 b
import sys
input=sys.stdin.readline

N,M = (int(x) for x in input().rstrip('\n').split())
As = [int(x) for x in input().rstrip('\n').split()]
As = sorted(As,reverse = True)
rest = M
for _ in range(M):
  if rest == 0:
    break
  d = As[0]
  b = d//2 - d//4
  for i in range(N):
    a = As[i]
    check = 0
    if a-a//2<b:
      if rest > i:
        ad = [x//2 for x in As[:i]]
        As = As[i:]
        As.extend(ad)
        rest -= i
        check += 1
        As = sorted(As,reverse = True)
        break
      else:
        ad = [x//2 for x in As[:rest]]
        As = As[rest:]
        As.extend(ad)
        check += 1
        rest = 0
        break
    if i == N-1:
      if check == 0:
        if rest > N:
          As = [x//2 for x in As]
          rest -= N
        else:
          ad = [x//2 for x in As[:rest]]
          As = As[rest:]
          As.extend(ad)
          rest = 0
          break
print(sum(As))
