CodeEff/ECCO huggingface dataset:
# Original solution
import math, string, itertools, fractions, heapq, collections, re,  array, bisect, sys, random, time, copy, functools


sys.setrecursionlimit(10**7)
inf = 10 ** 20
eps = 1.0 / 10**10
mod = 10**9+7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]


def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)


def main():
    S = input()

    # 10文字までしかないので、一個ずつ見ていっても良いのでは
    result = 10**10
    for i in range(0, len(S) - 2):
        r = min(abs(753 - int(S[i:i+3])), abs(int(S[i:i+3]) - 753))
        if r < result:
            result = r

    print(result)

main()


# Optimized solution
import math, string, itertools, fractions, heapq, collections, re,  array, bisect, sys, random, time, copy, functools


sys.setrecursionlimit(10**7)
inf = 10 ** 20
eps = 1.0 / 10**10
mod = 10**9+7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]


def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)


def main():
    S = input()

    # 10文字までしかないので、一個ずつ見ていっても良いのでは
    result = 10**10
    for i in range(0, len(S) - 2):
        result = min(abs(753 - int(S[i:i+3])), result)

    print(result)


main()
# Original solution
# 2019-11-11 16:07:35(JST)
import sys
# import collections
# import math
# from string import ascii_lowercase, ascii_uppercase, digits
# from bisect import bisect_left as bi_l, bisect_right as bi_r
# import itertools
# from functools import reduce
# import operator as op
# from scipy.misc import comb # float
# import numpy as np 

like = 753
def main():
    S = sys.stdin.readline().rstrip()
    min_diff = 642
    for i in range(len(S)-2):
        x = int(S[i:i+3])
        diff = abs(753 - x)
        min_diff = min(min_diff, diff)
    print(min_diff)

if __name__ == "__main__":
    main()


# Optimized solution
import sys

target = 753

s = sys.stdin.readline().rstrip()

def main():
    d = 642
    for i in range(len(s) - 2):
        d = min(d, abs(target - int(s[i:i+3])))
    
    return d

if __name__ == '__main__':
    ans = main()
    print(ans)
# Original solution
N, M = list(map(int, input().split()))
Alist = list(map(int, input().split()))

Alist = sorted(Alist, reverse=True)
for i in range(M):
    Alist[0] = Alist[0]//2
    Alist = sorted(Alist, reverse=True)

print((sum(Alist)))

# Optimized solution
import heapq
N, M = list(map(int, input().split()))
Alist = list(map(int, input().split()))

q = []
for a in Alist:
    heapq.heappush(q, -a)

for i in range(M):
    m = heapq.heappop(q)
    heapq.heappush(q, -((-m)//2))

print((-sum(q)))
# Original solution
import bisect

def main():
    N, M = list(map(int, input().split()))
    A = list(map(int, input().split()))

    A.sort()

    for i in range(M):
        a = A.pop()
        a = a // 2
        bisect.insort_right(A, a)

    # print(A)
    x = sum(A)
    print(x)


if __name__ == "__main__":
    main()

# Optimized solution
import heapq

def main():
    N, M = list(map(int, input().split()))
    A = list(map(int, input().split()))
    A = [-1 * i for i in A]

    heapq.heapify(A)

    for i in range(M):
        a = heapq.heappop(A)
        a = -1 * (-1 * a // 2)
        heapq.heappush(A, a)


    x = -1 * sum(A)
    print(x)


if __name__ == "__main__":
    main()
# Original solution
n,m=list(map(int,input().split()))

l=list(map(int,input().split()))

for i in range(m):
    j= l.index(max(l))
    l[j] = l[j]//2


print((sum(l)))


# Optimized solution
import heapq

n, m = list(map(int, input().split()))
a = list([-int(x) for x in input().split()])
heapq.heapify(a)

for _ in range(m):
    tmp = -heapq.heappop(a)
    tmp //= 2
    heapq.heappush(a,-tmp)
print((-sum(a)))
# Original solution
N, M = list(map(int, input().split()))
A = list(map(int, input().split()))

A.sort(reverse=True)

for i in range(M):
    A[A.index(max(A))] //= 2

print((sum(A)))

# Optimized solution
import heapq

N, M = list(map(int, input().split()))
A = list([int(x)*(-1) for x in input().split()])

heapq.heapify(A)

for _ in range(M):
    mn = heapq.heappop(A)
    heapq.heappush(A, -mn//2*(-1))

print((-sum(A)))
# Original solution
N,M = list(map(int,input().split()))
A = list(map(int,input().split()))
A = sorted(A,reverse=True)
for i in range(M):
    maxindex = A.index(max(A))
    A[maxindex] = A[maxindex]//2
print((sum(A)))

# Optimized solution
N,M = list(map(int,input().split()))
A = list(map(int,input().split()))
A = list([x*(-1) for x in A])
import heapq
heapq.heapify(A)

for i in range(M):
    maxA = (((heapq.heappop(A))*(-1))//2)*(-1)
    heapq.heappush(A,maxA)
   
    
print((sum(A)*-1))
# Original solution
N,M=list(map(int,input().split()))
A=list(map(int,input().split()))
for i in range(M):
  A=sorted(A)
  A[len(A)-1]=A[len(A)-1]//2
print((sum(A)))

# Optimized solution
N,M=list(map(int,input().split()))
A=list(map(int,input().split()))

while M>0:
    A.sort(reverse=True)
    if A[0]==0:
        break
    judge=A[0]//2
    for i in range(len(A)):
        if A[i]>judge and M>0:
            A[i]=A[i]//2
            M-=1
        else:
            break
print((sum(A)))
# Original solution
import math


def max_index(list, max_index):
    r = -1
    max = -1
    for i in range(max_index + 1):
        v = list[i]
        if v > max:
            max = v
            r = i
    return r


def use_coupon(a, m):
    current_index = 0
    for _ in range(m):
        index = max_index(a, current_index)
        a[index] /= 2
        current_index += index + 1
        if current_index >= len(a):
            current_index = len(a)-1


def sum(a):
    s = 0
    for v in a:
        s += math.floor(v)
    return s


n, m = list(map(int, input().split(" ")))
a = list(map(int, input().split(" ")))
a.sort(reverse=True)

use_coupon(a, m)

print((sum(a)))


# Optimized solution
import math
from heapq import heappush, heappop


def rint(s):
    return -int(s)


def sum(a):
    s = 0
    for v in a:
        s += math.floor(-v)
    return s


n, m = list(map(int, input().split(" ")))
a = list(map(rint, input().split(" ")))
a.sort()

for i in range(m):
    v = heappop(a)
    heappush(a, v/2)

print((sum(a)))
# Original solution
N,M=list(map(int,input().split()))
A=list(map(int,input().split()))

list.sort(A, reverse=True)
#print(A)
for m in range(M):
    tmp = A[0] / 2
    del A[0]
    insindex = N
    for i in range(len(A)):
        if A[i] < tmp:
            insindex = i
            break
    A.insert(insindex, tmp)
for i in range(len(A)):
    A[i] = int(A[i])
    
print((sum(A)))

# Optimized solution
import heapq

N,M=list(map(int,input().split()))
A=list(map(int,input().split()))
q = []
for x in A:
    heapq.heappush(q, -x)
for m in range(M):
    x = heapq.heappop(q)
    x /= 2
    heapq.heappush(q, x)
ans = 0
for x in q:
    ans += int(-x)
print(ans)
# Original solution
n, m = list(map(int, input().split()))
a = list(map(int, input().split()))
for i in range(m):
    x = a.index(max(a))
    a[x] //= 2
print((sum(a)))


# Optimized solution
import heapq
n, m = list(map(int, input().split()))
a = [int(i) * (-1) for i in input().split()]
heapq.heapify(a)
for i in range(m):
    x = heapq.heappop(a) * (-1) // 2
    heapq.heappush(a, x * (-1))
print((-sum(a)))
# Original solution
n,m=list(map(int, input().split()))
a=list(map(int, input().split()))
for i in range(m):
  ma=max(a)
  a.remove(ma)
  a.append(ma//2)
print((sum(a)))



# Optimized solution
import heapq
n,m=list(map(int, input().split()))
a=[-int(j) for j in input().split()]
heapq.heapify(a)
for i in range(m):
  v=heapq.heappop(a)
  heapq.heappush(a, -(-v//2))
print((-sum(a)))
# Original solution
import math
n,a=list(map(int,input().split()))
list=list(map(int,input().split()))
list.sort()
x=0
for i in range(a):
   x = max(list)/2
   x=math.floor(x)
   list.pop()
   list.append(x)
   list.sort()
print((sum(list)))

# Optimized solution
import heapq
N, M = list(map(int,input().split()))
h = []
for i in input().split():
  heapq.heappush(h,-int(i))
for i in range(M):
  x = -heapq.heappop(h)
  x //=2
  heapq.heappush(h,-x)
print((-sum(h)))
# Original solution
[N,M] = list(map(int,input().split()))
A = list(map(int,input().split()))

out=sum(A)
for i in range(M):
    saidai = max(A)
    out-=saidai
    out+=saidai//2
    A[A.index(saidai)] = saidai//2
    # print('dam,out:',saidai,out)

print(out)


# Optimized solution
[N,M] = list(map(int,input().split()))
A = list(map(int,input().split()))
out=sum(A)
import heapq
a = list([x*(-1) for x in A])  # 各要素を-1倍 最大値取り出すため
heapq.heapify(a)
# print(a)

for i in range(M):
    # saidai = max(A)
    saidai = heapq.heappop(a)*(-1)
    out-=saidai
    out+=saidai//2
    # A[A.index(saidai)] = saidai//2
    heapq.heappush(a, (saidai//2)*(-1))
    # print('dam,out,a:',saidai,out,a)

print(out)
# Original solution
import math

n,m = list(map(int, input().split()))
a = list(map(int, input().split()))
# a.sort()

def waribiki(s,maisu):
    return math.floor(s/(2**maisu))

for _ in range(m):
    a.append(waribiki(max(a),1))
    a.remove(max(a))

print((sum(a)))

# Optimized solution
import heapq
n,m = list(map(int, input().split()))
a = list([int(x)*(-1) for x in input().split()])
heapq.heapify(a)
 
for i in range(m):
	target = heapq.heappop(a)
	heapq.heappush(a, (-1)*(-target//2))
	
print((-sum(a)))
# Original solution
n,m = list(map(int,input().split()))
a = list(map(int,input().split()))
while m>0:
    a[a.index(max(a))] //=2
    m-=1
print((sum(a)))

# Optimized solution
import heapq
n,m = list(map(int,input().split()))
a = list(map(int,input().split()))
a = list([x*(-1) for x in a])
heapq.heapify(a)
while m>0:
    ma = heapq.heappop(a)*(-1)
    ma //=2
    heapq.heappush(a,ma*(-1))
    m-=1
print((sum(a)*(-1)))
# Original solution
N, M = list(map(int, input().split()))
A = [int(i) for i in input().split()]

for i in range(M):
    ind = A.index(max(A))
    A[ind] = max(A)//2
print((sum(A)))

# Optimized solution
import heapq
N, M = list(map(int, input().split()))
A = [-int(i) for i in input().split()]
heapq.heapify(A)
for i in range(M):
    max_ = heapq.heappop(A)
    max_ = -max_//2
    heapq.heappush(A, -max_)
print((-sum(A)))
# Original solution
n, m = list(map(int, input().split()))
A = list(map(int, input().split()))

for _ in range(m):
    i = A.index(max(A))
    A[i] /= 2
A = [int(a) for a in A]

print((sum(A)))


# Optimized solution
n, m = list(map(int, input().split()))
A = list(map(int, input().split()))

A = [a * (-1) for a in A]
import heapq
heapq.heapify(A)

for _ in range(m):
    a = heapq.heappop(A) * (-1)
    heapq.heappush(A, a // 2 * (-1))

print((abs(sum(A))))
# Original solution
import math

[n,m] = [int(x) for x in input().split(" ")]
an = [int(x) for x in input().split(" ")]
an.sort(reverse=True)

for i in range(m):
    max_value = an[0]
    an[0] = max_value / 2
    an.sort(reverse=True)

discounted_an = [math.floor(x) for x in an]
print((sum(discounted_an)))

# Optimized solution
import math

[n,m] = [int(x) for x in input().split(" ")]
an = [int(x) for x in input().split(" ")]
an.sort(reverse=True)

log2_an = [math.ceil(math.log2(x) + 1) for x in an]
max_log2 = log2_an[0]
rest_ticket = m

for i in range(max_log2):
    cnt = log2_an.count(log2_an[0])
    if(cnt <= rest_ticket):
        for j in range(cnt):
            an[j] = an[j] / 2
            log2_an[j] -= 1
    else:
        for j in range(rest_ticket):
            an[j] = an[j] / 2
        break
    rest_ticket -= cnt
    an.sort(reverse=True)

discounted_an = [math.floor(x) for x in an]
print((sum(discounted_an)))
# Original solution
N ,M = list(map(int, input().split()))
A_list = [int(i) * (-1) for i in input().split()]


import heapq
for i in range(M):
    heapq.heapify(A_list)
    x = heapq.heappop(A_list) / 2
    heapq.heappush(A_list, (-1)*int(-x))

print((-sum(A_list)))


# Optimized solution
N ,M = list(map(int, input().split()))
A_list = [int(i) * (-1) for i in input().split()]


import heapq

heapq.heapify(A_list)
for i in range(M):
    x = heapq.heappop(A_list)
    heapq.heappush(A_list, (-1)*(-x//2))

print((-sum(A_list)))
# Original solution
import bisect
from collections import deque
import math 
n,m = list(map(int,input().split()))
a = sorted(deque(list(map(int, input().split()))))
for i in range(m):
    p = a.pop()
    p = math.floor(p/2)
    index = bisect.bisect_left(a,p)
    a.insert(index,p)
print((sum(a)))

# Optimized solution
import heapq 
import math 
n,m = list(map(int,input().split()))
a = list([int(x)*(-1) for x in input().split()])
heapq.heapify(a)
for i in range(m):
    p = heapq.heappop(a)
    p = math.ceil(p/2)
    heapq.heappush(a,p)
print((sum(a)*(-1)))
# Original solution
import bisect


n,m = list(map(int,input().split()))
a = list(map(int,input().split()))
a = sorted(a)

for _ in range(m):
    a_tmp = a.pop()
    a_tmp //= 2
    if(len(a)==0):a.append(a_tmp)
    else:
        if(a_tmp >= a[-1]):a.append(a_tmp)
        elif(a_tmp <= a[0]):a.insert(0,a_tmp)
        else:
            index = bisect.bisect_left(a,a_tmp)
            a.insert(index,a_tmp)


print((sum(a)))


# Optimized solution
import heapq

n,m = list(map(int,input().split()))
a = list([int(x)*(-1) for x in input().split()])

heapq.heapify(a)

for _ in range(m):
    x = heapq.heappop(a) * -1
    x //= 2
    heapq.heappush(a,-1*x)
print((-sum(a)))
# Original solution

import heapq

n,m = list(map(int,input().split()))
a = list([int(x)*(-1) for x in input().split()])

heapq.heapify(a)

for _ in range(m):
    x = heapq.heappop(a) * -1
    x //= 2
    heapq.heappush(a,-1*x)
print((-sum(a)))

# Optimized solution
import heapq

#N,Mを取得
n,m = list(map(int,input().split()))
#A_iを取得する…と見せかけて、A_iを-1倍したものをListで取得
a = list([int(x)*(-1) for x in input().split()])

#AをListから、priority queueと言うものに変換(コレはheap queueだけど、まあ同じ)
heapq.heapify(a)

for _ in range(m):  #割引券持ってるだけ使い続ける
    x = heapq.heappop(a) * -1       #priority queueの先頭の値(一番値が小さい)を取り出して、-1をかけて元の値に戻す。
    x //= 2     #割引する
    heapq.heappush(a,-1*x)      #   priority queueにお返しする(-1をかけなおして)。

#割引が終わったら、合計金額を取得する。
print((-sum(a)))
# Original solution
import sys
input = sys.stdin.readline

import heapq

n,m=list(map(int,input().split()))
a=list([int(x)*-1 for x in input().split()])
heapq.heapify(a)

for _ in range(m):
    Min=heapq.heappop(a)
    Min=(-Min//2)*-1
    heapq.heappush(a,Min)
print((sum(a)*-1))


# Optimized solution
import heapq

n,m=list(map(int,input().split()))
a=[]

for i in input().split():
    heapq.heappush(a,-int(i))

for j in range(m):
    highest = heapq.heappop(a)
    heapq.heappush(a,-(-highest//2))

print((-(sum(a))))
# Original solution
N,M=input().split()
N,M=int(N),int(M)
A=input().split()
A=[int(n) for n in A]

A.sort(reverse=True)

for i in range(M):
    a=A[0]//2
    del A[0]
    flag=True
    for j in range(N-1):
        #print(A,a,A[j])
        if A[j]<a:
            A.insert(j,a)
            #print('inserted',A)
            flag=False
            break
    if flag:
        A.insert(N-1,a)
        #print('inserted',A)

sum=0
for i in range(N):
    sum+=A[i]
print(sum)


# Optimized solution
import heapq

N,M=input().split()
N,M=int(N),int(M)
A=input().split()
A=[-int(n) for n in A]

heapq.heapify(A)

for i in range(M):
    a=((-1*heapq.heappop(A))//2)*(-1)
    heapq.heappush(A,a)
sum=0
for i in range(N):
    sum+=A[i]
print((-sum))
# Original solution
n, m=list(map(int, input().split()))
prices=list(map(int, input().split()))
for i in range(m):
  prices[prices.index(max(prices))]//=2
print((sum(prices)))

# Optimized solution
import heapq

n, m=list(map(int, input().split()))
A=list([int(x)*(-1) for x in input().split()])
heapq.heapify(A)

for _ in range(m):
  temp=(-1)*heapq.heappop(A)>>1
  heapq.heappush(A, temp*(-1))
print((-sum(A)))
# Original solution
import sys
import heapq

input = sys.stdin.readline
 
N, M =  list(map(int, input().split()))
A = list(map(int, input().split()))

A = list([x * (-1) for x in A])
heapq.heapify(A)

for _ in range(M):
    mx = heapq.heappop(A)
    heapq.heappush(A, mx // 2 if mx % 2 == 0 else mx // 2 + 1)

print((sum(A) * (-1)))

# Optimized solution
import sys
import heapq

input = sys.stdin.readline
 
N, M =  list(map(int, input().split()))
A = list(map(int, input().split()))

#A = list(map(lambda x: x * (-1), A))
A = [-i for i in A]
heapq.heapify(A)

for _ in range(M):
    mx = heapq.heappop(A)
    heapq.heappush(A, mx // 2 if mx % 2 == 0 else mx // 2 + 1)

print((sum(A) * (-1)))
# Original solution
import heapq

N, M = [int(i) for i in input().split()]
a = input().split()
A = [int(i) for i in a]
#print(N, M)
#print(A)

def heapsort(list):
    h = []
    for i in A:
        heapq.heappush(h, i)
    return [heapq.heappop(h) for i in range(len(h))]

for i in range(M):
    A = heapsort(A)
    n = len(A) - 1
    A[n] = A[n]//2

print((sum(A)))

# Optimized solution
import heapq

N, M = [int(i) for i in input().split()]
A = [-int(i) for i in input().split()]
#print(N, M)
#print(A)

heapq.heapify(A)
for i in range(M):
    a = -heapq.heappop(A)
    a = a//2
    heapq.heappush(A, -a)

print((-sum(A)))
# Original solution
n, m = [int(i) for i in input().split()]
a = [int(i) for i in input().split()]
for _ in range(m):
  a[a.index(max(a))] /= 2
for i in range(n):
  a[i] = int(a[i])
print((sum(a)))

# Optimized solution
import heapq
n, m = [int(i) for i in input().split()]
a = [-int(i) for i in input().split()]
heapq.heapify(a)
for _ in range(m):
  value = heapq.heappop(a)
  value /= 2
  heapq.heappush(a, value)
for i in range(n):
  a[i] = int(-a[i])
print((sum(a)))
# Original solution
N,M = list(map(int,input().split()))
a = list(map(int,input().split()))

for i in range(M):
    x = max(a)
    a[a.index(x)]=x//2
print((sum(a)))

# Optimized solution
import heapq
N,M = list(map(int,input().split()))
a = [-i for i in list(map(int,input().split()))]
heapq.heapify(a)
for i in range(M):
    m = heapq.heappop(a)
    heapq.heappush(a,-(-m//2))
print((-sum(a)))
# Original solution
import sys
def input(): return sys.stdin.readline().strip()
def mapint(): return list(map(int, input().split()))
sys.setrecursionlimit(10**9)

N, M = mapint()
As = list(mapint())
Q = []
from heapq import heappop, heappush
for a in As:
    heappush(Q, -a)
for i in range(M):
    v = heappop(Q)
    heappush(Q, v/2)
lis = [-int(x) for x in Q]
print((sum(lis)))

# Optimized solution
import sys
def input(): return sys.stdin.readline().strip()
def mapint(): return list(map(int, input().split()))
sys.setrecursionlimit(10**9)

N, M = mapint()
As = list(mapint())
from heapq import heappush, heappop
Q = []

for a in As:
    heappush(Q, -a)

for i in range(M):
    a = -heappop(Q)
    heappush(Q, -(a//2))

print((-sum(Q)))
# Original solution
from heapq import heappush, heappop

N, M, *A = list(map(int, open(0).read().split()))

q = []
for v in A:
    heappush(q, -v)
    
for _ in range(M):
    v = heappop(q)
    heappush(q, -((-v) // 2))
    
print((-sum(q)))


# Optimized solution

from heapq import heappop, heappush

N, M = list(map(int, input().split()))
X = list(map(int, input().split()))

pq = []
for v in X:
    heappush(pq, -v)

for _ in range(M):
    u = heappop(pq)
    heappush(pq, -(-u // 2))

print((-sum(pq)))
# Original solution
# encoding:utf-8
import copy
import random
import bisect #bisect_left　これで二部探索の大小検索が行える
import fractions #最小公倍数などはこっち
import math
import sys

mod = 10**9+7
sys.setrecursionlimit(mod) # 再帰回数上限はでdefault1000

def LI(): return list(map(int, sys.stdin.readline().split()))
N,M = LI()
A = LI()

A.sort()
for i in range(M):
    a_max = A.pop() // 2
    bisect.insort_left(A,a_max)
print((sum(A)))


# Optimized solution
# encoding:utf-8
import copy
import random
import bisect #bisect_left　これで二部探索の大小検索が行える
import fractions #最小公倍数などはこっち
import math
import sys
import heapq

mod = 10**9+7
sys.setrecursionlimit(mod) # 再帰回数上限はでdefault1000

def LI(): return list(map(int, sys.stdin.readline().split()))
N,M = LI()
A = LI()

pq = []
for a in A:
    heapq.heappush(pq,-a)

for _ in range(M):
    heapq.heappush(pq,-(-heapq.heappop(pq) // 2))
    # print(pq)

print((-sum(pq)))
# Original solution
N, M = list(map(int, input().split()))
A = [int(x) for x in input().split()]

for _ in range(M):
    A[A.index(max(A))] = max(A)//2

print((sum(A)))


# Optimized solution
import heapq

N, M = list(map(int, input().split()))
A = [-int(x) for x in input().split()]
heapq.heapify(A)
for _ in range(M):
    pop = heapq.heappop(A)
    if pop % 2 == 0:
        num = pop//2
    else:
        num = (pop+1)//2
    heapq.heappush(A, num)

print((-sum(A)))
# Original solution
n, m = list(map(int, input().split()))
A = list(map(int, input().split()))
A = sorted(A)

from bisect import insort_left

for _ in range(m):
    x = A.pop()//2
    insort_left(A, x)

print((sum(A)))


# Optimized solution
n, m = list(map(int, input().split()))
A = list(map(int, input().split()))
A = [x * (-1) for x in A]
A = sorted(A)

from heapq import heappush, heappop

for _ in range(m):
    x = heappop(A)
    heappush(A, (-1*x)//2*(-1))

print((sum(A)*(-1)))
# Original solution
n, m = list(map(int, input().split()))
A = list(map(int, input().split()))
A = [x * (-1) for x in A]
A = sorted(A)

from heapq import heappush, heappop

for _ in range(m):
    x = heappop(A)
    heappush(A, (-1*x)//2*(-1))

print((sum(A)*(-1)))


# Optimized solution
n, m = list(map(int, input().split()))
A = list(map(int, input().split()))
A = [x * (-1) for x in A]
A = sorted(A)

from heapq import heappush, heappop

for _ in range(m):
    x = heappop(A)
    heappush(A, -(-x//2))

print((-sum(A)))
# Original solution
n, m = list(map(int, input().split()))
A = list(map(int, input().split()))
A = [x * (-1) for x in A]
A = sorted(A)

from heapq import heappush, heappop

for _ in range(m):
    x = heappop(A)
    heappush(A, -(-x//2))

print((-sum(A)))


# Optimized solution
n, m = list(map(int, input().split()))
A = [-int(a) for a in input().split()]
A = sorted(A)

from heapq import heappush, heappop

for _ in range(m):
    x = heappop(A)
    heappush(A, -(-x//2))

print((-sum(A)))
# Original solution
import heapq

N, M = list(map(int, input().split()))

A = [int(i)*(-1) for i in input().split()]



# print(A)
# for i in range(M):
# 	max_index = A.index(max(A))
# 	A[max_index] = int(A[max_index]/2)

# print(sum(A))


for i in range(M):
	heapq.heapify(A)

	min = heapq.heappop(A)
	# 最小値を削除と値を渡す
	# print(A)
	# print(min)

	heapq.heappush(A,int(min/2))
	# print(A)


print((sum(A)*(-1)))

# Optimized solution
import heapq
import sys
input = sys.stdin.readline

N, M = list(map(int, input().split()))

A = [int(i)*(-1) for i in input().split()]



# print(A)
# for i in range(M):
# 	max_index = A.index(max(A))
# 	A[max_index] = int(A[max_index]/2)

# print(sum(A))
heapq.heapify(A)

for i in range(M):
	

	min = heapq.heappop(A)
	# 最小値を削除と値を渡す
	# print(A)
	# print(min)

	heapq.heappush(A,int(min/2))
	# print(A)


print((sum(A)*(-1)))
# Original solution
# ABC141D - Powerful Discount Tickets
from heapq import heapify, heappop, heappush


def main():
    N, M, *A = list(map(int, open(0).read().split()))
    H = [-i for i in A]
    heapify(H)
    pop_max, push_max = lambda: -heappop(H), lambda x: heappush(H, -x)
    for _ in range(M):
        x = pop_max()
        push_max(x // 2)
    ans = -sum(H)
    print(ans)


if __name__ == "__main__":
    main()

# Optimized solution
# ABC141D - Powerful Discount Tickets
from heapq import heapify, heapreplace


def main():
    N, M, *A = list(map(int, open(0).read().split()))
    H = [-i for i in A]
    heapify(H)
    for _ in range(M):
        x = H[0]
        heapreplace(H, x // 2 + x % 2)
    ans = -sum(H)
    print(ans)


if __name__ == "__main__":
    main()