n,k = map(int,input().split())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
sum1 = 0
list1 = []
for i in range(len(a)):
sum1 += a[i]
if a[i] < b[i]:
list1.append(b[i] - a[i])
list1.sort(reverse=True)
if k >= len(list1):
for j in list1:
sum1 += j
else:
for j in range(k):
sum1 += list1[j]
print(sum1)
n = int(input())
a = list(map(int,input().split()))
if n == 1:
print(abs(a[0]))
else:
list1 = []
list2 = []
sum1 = 0
for i in range(len(a)):
a[i] = abs(a[i])
if i % 2 == 0:
sum1 += a[i]
list1.append(a[i])
else:
list2.append(a[i])
sum1 -= a[i]
min_list1 = min(list1)
max_list2 = max(list2)
if max_list2 > min_list1:
print(sum1 + 2 * (max_list2-min_list1))
else:
print(sum1)
3.小蓝的礼物
思路:先加,加到超过了再看用卷能不能使总数加1
import math
n,k = map(int,input().split())
a = list(map(int,input().split()))
shu = 0
sum11 = 0
a.sort()
for i in range(len(a)):
sum11 += a[i]
if sum11 > k:
sum11 -= a[i]
if sum11 + math.ceil(a[i] / 2) <= k:
shu += 1
break
else:
break
shu += 1
print(shu)
n = int(input())
a = list(map(int,input().split()))
a.sort(reverse=True)
sum = 0
q = 0
w = 0
for i in range(len(a)):
if a[i] >= 0:
q += 1
sum += a[i]
else:
w = a[i]
break
if q % 2 == 0:
print(sum)
else:
if w == 0:
print(sum-a[q-1])
else:
if a[q-1] > abs(w):
print(sum+w)
else:
print(sum-a[q-1])