Harryxun/sft_time huggingface dataset:
### BUGGY CODE ###

k,x=map(int,input().split())
a=x-k+1
b=x+k-1
a=min(a,-1000000)
b=max(b,1000000)
c=range(a,b+1)
for i in c:
  print(i,end=" ")

### FIXED CODE ###

k,x=map(int,input().split())
a=x-k+1
b=x+k-1
a=max(a,-1000000)
b=min(b,1000000)
c=[k for k in range(a,b+1)]
for i in c:
  print('%d '%i),
### BUGGY CODE ###

n,m = map(int,input().split())
a = [int(c) for c in input().split()]
a.sort()
for i in range(m):
	a[-1] = a[-1]//2
	a.sort()
	
print(sum(a))


### FIXED CODE ###

n,m = map(int,input().split())
a = [int(c) for c in input().split()]
from heapq import *
from math import *
a = [-i for i in a]
heapify(a)
while m > 0:
	heappush(a,-((-heappop(a))//2))
	m -=1
print(-sum(a))
### BUGGY CODE ###

a=int(input())
ans=0
for i in range(1,a+1,1):
  x=a//i
  ans+=((x**2+x)//2)*i
print(ans)

### FIXED CODE ###

a=int(input())
b=(a)//2+1
ans=0
for i in range(1,b,1):
  x=a//i
  ans+=((x**2+x)//2)*i
ans+=(a**2+a+b-b**2)//2
print(ans)
### BUGGY CODE ###

N=int(input())
B=[]
for i in range(N):
  s=input()
  s*=2
  B.append(s)

def solve(a,b):
  for i in range(N):
    for j in range(i+1,N):
      if B[a+i][b+j]!=B[a+j][b+i]:
        return False
  return True

ans=0
for i in range(N):
  if solve(0,i):
    ans+=N

print(ans)

### FIXED CODE ###

N=int(input())
S=[input() for _ in range(N)]

def solve(N,S):
  st=[tuple(x) for x in S]
  ch=list(zip(*st))
  ans=0
  for i in range(N):
    if st==ch:
      ans+=N
    st=st[-1:]+st[:-1]
    ch=[row[-1:] + row[:-1] for row in ch]
  return ans

print(solve(N,S))
### BUGGY CODE ###

n = int(input())
p  = list(map(int,input().split()))
x = 1
for i in range(1,len(p)):
  if p[i] == min(p[:i+1]):
    x += 1
print(x)

### FIXED CODE ###

n = int(input())
p  = list(map(int,input().split()))
x = 1
mn = p[0]
for i in range(1,len(p)):
  if p[i] <= mn:
    x += 1
    mn = p[i]
print(x)
### BUGGY CODE ###

n, q = map(int, input().split())
s = input()
s_list = []

for _ in range(q):
  l, r = map(int, input().split())
  s_list.append(s[l-1:r])
  
for s in s_list:
  print(s.count('AC'))

### FIXED CODE ###

N,Q=map(int,input().split())
S=input()
count=[0]*N
for i in range(1,N):
    count[i]+=count[i-1]
    if S[i-1:i+1]=="AC":count[i]+=1
for i in range(Q):
    l,r=map(int,input().split())
    print(count[r-1]-count[l-1])
### BUGGY CODE ###

import bisect
N = int(input())
numofcolor = 1
A = [0] * N
for i in range(N):
    A[i] = int(input())
listofmax = [A[0]]
lenoflistofmax = 1  # 実際のところnumofcolorと同じ値になる
for j in range(1, N):
    if listofmax[0] >= A[j]:
        numofcolor += 1
        lenoflistofmax += 1
        listofmax.insert(0, A[j])
    else:
        listofmax[bisect.bisect_left(listofmax, A[j]) - 1] = A[j]
print(numofcolor)


### FIXED CODE ###

import bisect
from collections import deque
de1 = deque()
N = int(input())
A = [0] * N
for i in range(N):
    A[i] = int(input())
de1.appendleft(A[0])
for j in range(1, N):
    if de1[0] >= A[j]:
        de1.appendleft(A[j])
    else:
        de1[bisect.bisect_left(de1, A[j]) - 1] = A[j]
print(len(de1))
### BUGGY CODE ###

import copy

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

for i in range(k):
    b = [0] * (n + 1)
    for j in range(n):
        l = max(0, j - a[j])
        r = min(j + a[j] + 1, n)
        b[l] += 1
        b[r] -= 1

    for j in range(n):
        b[j + 1] += b[j]
    b = b[:-1]

    if b == a:
        break
    a = copy.deepcopy(b)
print(*a, sep=' ')

### FIXED CODE ###

import copy

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

for i in range(k):
    b = [0] * (n + 1)
    for j in range(n):
        d = a[j]
        l = max(0, j - d)
        r = min(j + d + 1, n)
        b[l] += 1
        b[r] -= 1

    for j in range(n):
        b[j + 1] += b[j]
    b = b[:-1]

    if b == a:
        break
    a = copy.deepcopy(b)
print(*a, sep=' ')
### BUGGY CODE ###

import numpy as np
N,M = map(int,input().split())
cards = list(map(int,input().split()))
exchange_lists=[]
for i in range (M):
  exchange_lists.append(list(map(int,input().split())))

def exchange_cards(cards,exchange):
  cards.sort()
  for i in range(len(cards)):
    if (exchange[1] > cards[i])and(exchange[0] > i):
      cards[i] = exchange[1]
    else:
      break
  return cards
      
for i in range(M):
  cards = exchange_cards(cards,exchange_lists[i])
print(np.sum(cards))

### FIXED CODE ###

import numpy as np
N,M = map(int,input().split())
cards = list(map(int,input().split()))
exchange_lists=[]
for i in range (M):
  exchange_lists.append(list(map(int,input().split())))
exchange_lists.sort(key = lambda x:x[1],reverse=True)
cards.sort()
count = 0
for i in range(M):
  exchange=exchange_lists[i]
  num = 0
  for j in range(count,N):
    if (exchange[1] > cards[j])and(exchange[0] > num):
      cards[j] = exchange[1]
      count += 1
      num+=1
    else:
      break
  
print(np.sum(cards))
### BUGGY CODE ###

#!/usr/bin/env python3
#ABC70 D

import sys
import math
import bisect
sys.setrecursionlimit(1000000000)
from heapq import heappush, heappop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools import permutations
mod = 10**9 + 7

n = int(input())
abc = [list(map(int,input().split())) for _ in range(n-1)]
q,k = map(int,input().split())

g = [[] for _ in range(n)]
cost = [[float('inf')]*n for _ in range(n)]
for a,b,c in abc:
    g[a-1].append(b-1)
    g[b-1].append(a-1)
    cost[a-1][b-1] = c
    cost[b-1][a-1] = c

que = deque()
que.append((0,k-1))
c = [False]*n
dist = [float('inf')]*n
while que:
    d,v = que.popleft()
    dist[v] = min(dist[v],d)
    if not c[v]:
        c[v] = True
        for u in g[v]:
            que.append((d+cost[v][u],u))
for _ in range(q):
    x,y = map(int,input().split())
    print(dist[x-1] + dist[y-1])


### FIXED CODE ###

#!/usr/bin/env python3
#ABC70 D

import sys
import math
import bisect
sys.setrecursionlimit(1000000000)
from heapq import heappush, heappop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools import permutations
mod = 10**9 + 7

n = int(input())
abc = [list(map(int,input().split())) for _ in range(n-1)]
q,k = map(int,input().split())

g = [[] for _ in range(n)]
for a,b,c in abc:
    g[a-1].append((b-1,c))
    g[b-1].append((a-1,c))

que = deque()
que.append(k-1)
dist = [-1]*n
dist[k-1] = 0
while que:
    v = que.popleft()
    for x,c in g[v]:
        if dist[x] == -1:
            dist[x] = dist[v] + c
            que.append(x)

for _ in range(q):
    x,y = map(int,input().split())
    print(dist[x-1] + dist[y-1])
### BUGGY CODE ###

n, k, q = map(int, input().split())
a = [int(input()) for i in range(q)]
class Member:
    def __init__(self, answer, point):
        self.answer = answer
        self.point = point
    def judge(self):
        if self.point <= 0:
            return 'No'
        else:
            return 'Yes' 
members = [Member(a.count(i+1), k)
                  for i in range(n)]
for member in members:
    member.point = member.point - q + member.answer
    print(member.judge())

### FIXED CODE ###

n, k, q = map(int, input().split())
a = [int(input()) for i in range(q)]
p = [k for i in range(n)]
def judge(x):
    if p[x] - q <= 0:
        return 'No'
    else:
        return 'Yes'
for i in range(q):
    p[a[i] - 1] += 1
b = [judge(i) for i in range(n)]
print('\n'.join(b))
### BUGGY CODE ###

import sys
l,n=map(int,input().split())
c=n
tree=[int(i) for i in sys.stdin]
reversed_tree=[l-i for i in reversed(tree)]
if n%2 == 0:
  ans= sum(tree)*2 + l*(n-1) +tree[n//2] - sum(tree[n//2:])*4
  ans2= sum(reversed_tree)*2 + l*(n-1) +reversed_tree[n//2] - sum(reversed_tree[n//2:])*4
  n-=1
  c-=1
  ans3= ans-tree.pop(0)*2-l+tree[n//2]*2
  ans= max(ans,ans3)
  ans4= ans2-reversed_tree.pop(0)*2-l+(reversed_tree[n//2])*2
  ans2= max(ans2,ans4)
else:
  ans= sum(tree)*2 + l*(n-1) - tree[n//2] - sum(tree[((n//2)+1):])*4
  ans3=ans
  ans2= sum(reversed_tree)*2 + l*(n-1) - reversed_tree[n//2] - sum(reversed_tree[((n//2)+1):])*4
  ans4=ans2
while n>1:
  n-=1
  ans_stack= ans3-tree.pop(0)*2-l+tree[(n-1)//2]+tree[(n+1)//2]
  ans= max(ans_stack,ans)
  ans3=ans_stack
  n-=1
  ans_stack= ans3-tree.pop(0)*2-l+tree[n//2]*2
  ans=max(ans_stack,ans)
  ans3=ans_stack
n=c
while n>1:
  n-=1
  ans_stack= ans4-reversed_tree.pop(0)*2-l+reversed_tree[(n-1)//2]+reversed_tree[(n+1)//2]
  ans2=max(ans_stack,ans2)
  ans4=ans_stack
  n-=1
  ans_stack= ans4-reversed_tree.pop(0)*2-l+reversed_tree[n//2]*2
  ans2=max(ans2,ans_stack)
  ans4=ans_stack
print(max(ans,ans2))


### FIXED CODE ###

import sys
from collections import deque
l,n=map(int,input().split())
c=n
tree1=[int(i) for i in sys.stdin]
reversed_tree1=[l-i for i in reversed(tree1)]
tree=deque(tree1)
reversed_tree=deque(reversed_tree1)
if n%2 == 0:
  ans= sum(tree1)*2 + l*(n-1) +tree1[n//2] - sum(tree1[n//2:])*4
  ans2= sum(reversed_tree1)*2 + l*(n-1) +reversed_tree1[n//2] - sum(reversed_tree1[n//2:])*4
  n-=1
  c-=1
  ans3= ans-tree.popleft()*2-l+tree[n//2]*2
  ans= max(ans,ans3)
  ans4= ans2-reversed_tree.popleft()*2-l+(reversed_tree[n//2])*2
  ans2= max(ans2,ans4)
else:
  ans= sum(tree1)*2 + l*(n-1) - tree1[n//2] - sum(tree1[((n//2)+1):])*4
  ans3=ans
  ans2= sum(reversed_tree1)*2 + l*(n-1) - reversed_tree1[n//2] - sum(reversed_tree1[((n//2)+1):])*4
  ans4=ans2
for i in range(n//2):
  n-=1
  ans_stack= ans3-tree.popleft()*2-l+tree[(n-1)//2]+tree[(n+1)//2]
  ans= max(ans_stack,ans)
  ans3=ans_stack
  n-=1
  ans_stack= ans3-tree.popleft()*2-l+tree[n//2]*2
  ans=max(ans_stack,ans)
  ans3=ans_stack
n=c
for i in range(n//2):
  n-=1
  ans_stack= ans4-reversed_tree.popleft()*2-l+reversed_tree[(n-1)//2]+reversed_tree[(n+1)//2]
  ans2=max(ans_stack,ans2)
  ans4=ans_stack
  n-=1
  ans_stack= ans4-reversed_tree.popleft()*2-l+reversed_tree[n//2]*2
  ans2=max(ans2,ans_stack)
  ans4=ans_stack
print(max(ans,ans2))
### BUGGY CODE ###

import itertools
import operator
n,k = map(int,input().split())
a = list(map(int,input().split()))
cumpro = list(itertools.accumulate(a, func=operator.mul))
j = 0
for i in range(k,n):
    if j==0:
        last = cumpro[i-1]
        now = cumpro[i]//cumpro[j]
    else:
        now,last = cumpro[i]//cumpro[j],now
    print(['No','Yes'][last<now])
    j+=1

### FIXED CODE ###

n,k = map(int,input().split())
a = list(map(int,input().split()))
j = 0
for i in range(k,n):
    print(['No','Yes'][a[j]<a[i]])
    j+=1
### BUGGY CODE ###

import sys
input = sys.stdin.readline
import heapq
from operator import itemgetter
N, Q = map(int, input().split())
Stop = []
for i in range(N):
    S, T, X = map(int, input().split())
    Stop.append([S-X, X, 0, i])
    Stop.append([T-X, X, 1, i])
Stop.sort(key=itemgetter(0))
q = []
notClosed = [False]*N
for _ in range(Q):
    D = int(input())
    i = 0
    while i < len(Stop) and Stop[i][0] <= D:
        time, pos, lr, idx = Stop[i]
        if lr == 0:
            heapq.heappush(q, (pos, idx))
        else:
            notClosed[idx] = True
            while len(q)>0 and notClosed[q[0][1]]:
                aaa = heapq.heappop(q)[1]
        i+=1
    if len(q):
        print(q[0][0])
    else:
        print(-1)


### FIXED CODE ###

import sys
input = sys.stdin.readline
import heapq
from operator import itemgetter
from bisect import bisect_right
N, Q = map(int, input().split())
Stop = []
for i in range(N):
    S, T, X = map(int, input().split())
    Stop.append([S - X, X, 0, i])
    Stop.append([T - X, X, 1, i])
Stop.sort(key=itemgetter(0))
q = []
notClosed = [False]*N
A = [(-1, -1)]
for time, pos, lr, idx in Stop:
    if lr==0:
        heapq.heappush(q, (pos, idx))
    else:
        notClosed[idx] = True
        while len(q)>0 and notClosed[q[0][1]]:
            aaa = heapq.heappop(q)[1]

    if len(q):
        A.append((time, q[0][0]))
    else:
        A.append((time, -1))
A0 = list(map(itemgetter(0), A))
for _ in range(Q):
    D = int(input())
    idx = bisect_right(A0, D)

    print(A[idx-1][1])
### BUGGY CODE ###

import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)

from heapq import heappop, heappush

N = int(input())
A = [int(x) for x in input().split()]
B = [int(x) for x in input().split()]

q = []
push = lambda x,i: heappush(q, (-x,i))
def pop():
    x,i = heappop(q)
    return -x,i

for i,x in enumerate(B):
    push(x,i)

answer = 0
while q:
    x,i = pop()
    if x < A[i]:
        answer = -1
        break
    dx = x-A[i]
    nbd = B[(i-1)%N] + B[(i+1)%N]
    t = dx // nbd
    if t == 0:
        if x == A[i]:
            continue
        answer = -1
        break
    B[i] -= nbd * t
    answer += t
    push(B[i],i)

print(answer)


### FIXED CODE ###

import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)

from heapq import heappop, heappush

N = int(input())
A = [int(x) for x in input().split()]
B = [int(x) for x in input().split()]

q = []
push = lambda x,i: heappush(q, (-x,i))
for i,x in enumerate(B):
    push(x,i)

answer = 0
while q:
    x,i = heappop(q)
    x = -x
    if x < A[i]:
        answer = -1
        break
    dx = x-A[i]
    nbd = B[(i-1)%N] + B[(i+1)%N]
    t = dx // nbd
    if t == 0:
        if x == A[i]:
            continue
        answer = -1
        break
    B[i] -= nbd * t
    answer += t
    push(B[i],i)

print(answer)
### BUGGY CODE ###

import bisect
from itertools import accumulate
N, M = map(int, input().split())
A = sorted(list(map(int, input().split())))
ruiseki = list(accumulate(A[::-1]))

# 自分以上の数の個数がM個以上になる値のうち最大のもの
ok = 0
ng = 10 ** 15
while ok + 1 < ng:
    mid = (ok + ng) // 2
    cnt = 0
    ans = 0
    for a in A:
        x = bisect.bisect_left(A, mid - a)
        cnt += N - x
        if N - x >= 1:
            ans += ruiseki[N - x - 1] + (N - x) * a
    if cnt >= M:
        ok = mid
    else:
        ng = mid
# okで終わってる場合はcntがM個以上の場合があるから過分を引く
# ngで終わってる場合は残りM-cnt個のokを足す
print(ans + ok * (M - cnt)) 

### FIXED CODE ###

from itertools import accumulate
N, M = map(int, input().split())
A = sorted(list(map(int, input().split())))
ruiseki = list(accumulate(A[::-1]))

def syakutori(mid):
    x = 0
    cnt = 0
    ans = 0
    for i in range(N)[::-1]: # 大きい方から
        while x < N:
            if A[i] + A[x] >= mid:
                cnt += N - x
                if N - x >= 1:
                    ans += A[i] * (N - x) + ruiseki[N - x - 1]
                break
            else:
                x += 1

    return cnt, ans

# 自分以上の数の個数がM個以上になる値のうち最大のもの
ok = 0
ng = 10 ** 15
while ok + 1 < ng:
    mid = (ok + ng) // 2
    cnt, ans = syakutori(mid)
    if cnt >= M:
        ok = mid
    else:
        ng = mid
# okで終わってる場合はcntがM個以上の場合があるから過分を引く
# ngで終わってる場合は残りM-cnt個のokを足す
print(ans + ok * (M - cnt))
### BUGGY CODE ###

import sys
stdin = sys.stdin
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
nn = lambda: list(stdin.readline().split())
ns = lambda: stdin.readline().rstrip()
sys.setrecursionlimit(10**6)

n,m = na()
k = m//n
ans = 0
for i in range(1,k+1)[::-1]:
    if m%i == 0:
        ans = i
        break

print(ans)


### FIXED CODE ###

import sys
stdin = sys.stdin
sys.setrecursionlimit(10**6)
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
nn = lambda: list(stdin.readline().split())
ns = lambda: stdin.readline().rstrip()

#約数列挙
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)
    return divisors

n,m = na()
k = m/n
a = make_divisors(m)
ans = 0
for i in a:
    if i <= k:
        ans = max(ans,i)

print(ans)
### BUGGY CODE ###

import numpy as np
N, K = map(int, input().split())
A = list(map(int, input().split()))
foo = np.ones((42, N), dtype = "int32")
for k in range(len(A)):
    foo[0][k] = A[k]
if K <42:
    for q in range(K):
        for k in range(N):
            for j in range(1, min(foo[q][k]+1, N-k)):
                foo[q+1][k+j] +=1
            for j in range(1, min(foo[q][k]+1, k+1)):
                foo[q+1][k-j] +=1
        count =0
        for l in range(N):
            if foo[q+1][l] < N:
                break
            else:
                count +=1
        
        if count == N:
            break
        
                        
        #print(foo)
    print(" ".join(map(str, foo[q+1])))

     
else:
    print((str(N)+" ")*(N-1)+str(N))




### FIXED CODE ###

N, K = map(int, input().split())
A = list(map(int, input().split()))
foo = [[0 for k in range(N)] for k in range(42)]
for k in range(len(A)):
    foo[0][k] = A[k]
if K <42:
    for q in range(K):
        unko = [0 for k in range(N)]
        for k in range(N):
            if k + foo[q][k]+1 < N:
                unko[k + foo[q][k]+1] -=1
            unko[max(k - foo[q][k], 0)] +=1
        unchi = 0
        for k in range(N):
            unchi += unko[k]
            foo[q+1][k] = unchi
        #print(unko)
        #print(foo[q+1])
        count =0
        for l in range(N):
            if foo[q+1][l] < N:
                break
            else:
                count +=1
        
        if count == N:
            break
        
                        
        #print(foo)
    print(" ".join(map(str, foo[q+1])))

     
else:
    print((str(N)+" ")*(N-1)+str(N))
### BUGGY CODE ###

N = int(input())

for n in range(1,N+1):
    cnt = 0
    for i in range(1,int(n**0.5)+1):
        for j in range(1,int(n**0.5)+1):
            for k in range(1,int(n**0.5)+1):
                a = i**2 + j**2 + k**2 + i*j + j*k + k*i
                if a == n:
                    cnt += 1
    
    print(cnt)

### FIXED CODE ###

N = int(input())

anslist = [0] * N

for i in range(1,int(N**0.5)+1):
    for j in range(1,int(N**0.5)+1):
        for k in range(1,int(N**0.5)+1):
            a = i**2 + j**2 + k**2 + i*j + j*k + k*i
            if a <= N:
                anslist[a-1] += 1
    

for i in range(N):
    print(anslist[i])
### BUGGY CODE ###

import sys
input = sys.stdin.readline
from collections import deque

n = int(input())
p = list(map(int, input().split()))


# 迷路　BFS
def bfs(sx, sy):
    d = deque()
    d.append((sx, sy, distance[sx][sy]))
    check[sx][sy] = 0

    while len(d):
        x, y, dis = d.popleft()
        for i in range(0, 4):
            nx, ny = x + [1, 0, -1, 0][i], y + [0, 1, 0, -1][i]

            if 0 <= nx < n and 0 <= ny < n:
                # 更新できるマスは更新
                if distance[nx][ny] > dis:
                    distance[nx][ny] = dis
                    d.append((nx, ny, dis + check[nx][ny]))



distance = [[min(i, j, n - i - 1, n - j - 1) for i in range(n)] for j in range(n)]
check = [[1] * n for i in range(n)]
p = [((i-1)//n, (i-1) % n) for i in p]
ans=0
for i,j in p:
    ans+=distance[j][i]
    bfs(j, i)

print(ans)


### FIXED CODE ###

import sys
input = sys.stdin.readline

n = int(input())
p = list(map(int, input().split()))

distance = [[min(i, j, n - i - 1, n - j - 1) for i in range(n)] for j in range(n)]
check = [[1] * n for i in range(n)]
p = [((i - 1) // n, (i - 1) % n) for i in p]

def move(x,y,nx,ny):
    if distance[nx][ny] > distance[x][y] + check[x][y]:
        distance[nx][ny] = distance[x][y] + check[x][y]
        d.append((nx,ny))

ans = 0
for i, j in p:
    ans += distance[j][i]
    d=[]
    d.append((j,i))
    check[j][i] = 0
    while len(d):
        x, y = d.pop()
        if x!=0:
            move(x,y,x-1,y)
        if x!=n-1:
            move(x,y,x+1,y)
        if y!=0:
            move(x,y,x,y-1)
        if y!=n-1:
            move(x,y,x,y+1)

print(ans)
### BUGGY CODE ###

n, k = map(int, input().split())

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

le = [(i+1)/2 for i in l]

ls = list()
for i in range(n-k+1):
    ls.append(sum(le[i:i+k]))

print(max(ls))

### FIXED CODE ###

n, k = map(int, input().split())

l = list(map(int, input().split()))
l = [(i+1)/2 for i in l]

ls = [0, l[0]]
for i in range(1, n):
    ls.append(ls[-1]+l[i])

if n == 1:
    print(l[0])
else:
    lans = [ls[i+k]-ls[i] for i in range(len(ls)-k)]
    print(max(lans))
### BUGGY CODE ###

import math, string, itertools, fractions, heapq, collections, re,  array, bisect, sys, random, time, copy, functools
sys.setrecursionlimit(10**7)
from queue import PriorityQueue
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 _pf(s): return print(s, flush=True)

N, M = LI()
A = LI()

pq = PriorityQueue()
for a in A:
    pq.put((-a, a))

for i in range(M):
    val = pq.get()[1]
    val = math.floor(val/2)
    pq.put((-val, val))

ans = 0
while not pq.empty():
    ans += pq.get()[1]
print(ans)


### FIXED CODE ###

import math, string, itertools, fractions, heapq, collections, re,  array, bisect, sys, random, time, copy, functools
sys.setrecursionlimit(10**7)
from queue import PriorityQueue
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 _pf(s): return print(s, flush=True)

N, M = LI()
A = LI()

pq = PriorityQueue()
for a in A:
    pq.put((-a, a))

for i in range(M):
    val = pq.get()[1]
    val = math.floor(val/2)
    pq.put((-val, val))

ans = 0
while not pq.empty():
    ans += pq.get()[1]
print(ans)
### BUGGY CODE ###

x = int(input())
done=False
l=6500
for a in range(-l,l+1):
  for b in range(-l,l+1):
    if(not done and a**5-b**5==x):
      print(a,b)
      done=True

### FIXED CODE ###


x = int(input())
for a in range(-300,301):
  if(a<0):
    for b in range(-300,a):
      if(a**5-b**5==x):
        print(a,b)
        break
    else: continue
    break
  else:
    for b in range(-300,a):
      if(a**5-b**5==x):
        print(a,b)
        break
    else: continue
    break
### BUGGY CODE ###

import sys
def input(): return sys.stdin.readline().rstrip()

def main():
    N, K = map(int, input().split())
    MOD = 10 ** 9 + 7

    ans = 0
    memo = [0] * (K+1)
    def getLarge(x):
        if x == 1:
            return sum(memo)
        else:
            return sum(memo[x::x])

    for i in range(K, 0, -1):
        Ki = K // i
        c = Ki ** N - getLarge(i) % MOD
        memo[i] = c
        ans += i * c
        ans %= MOD
    print(ans % MOD)

if __name__ == '__main__':
    main()


### FIXED CODE ###

import sys
def input(): return sys.stdin.readline().rstrip()

def main():
    N, K = map(int, input().split())
    MOD = 10 ** 9 + 7

    ans = 0
    memo = [0] * (K+1)
    def getLarge(x):
        if x == 1:
            return sum(memo)
        else:
            return sum(memo[x::x])

    for i in range(K, 0, -1):
        Ki = K // i
        c = pow(Ki, N, MOD) - getLarge(i) % MOD
        memo[i] = c
        ans += i * c
        ans %= MOD
    print(ans % MOD)

if __name__ == '__main__':
    main()
### BUGGY CODE ###

n = int(input())
print(sum(range(n)))

### FIXED CODE ###

n = int(input())
print(n*(n-1)//2)
### BUGGY CODE ###

n = int(input())
a = list(map(int, input().split()))
res = []
for i in range(1,n+1):
  res.append(a.index(i)+1)
print(*res)


### FIXED CODE ###

n = int(input())
a = list(map(int, input().split()))
res = [0] * n
for i,val in enumerate(a):
  res[val-1] = i+1
print(*res)