Problem:
 Score : 200 points    Problem Statement A shop sells N kinds of fruits, Fruit 1, \ldots, N , at prices of p_1, \ldots, p_N yen per item, respectively. (Yen is the currency of Japan.)  Here, we will choose K kinds of fruits and buy one of each chosen kind. Find the minimum possible total price of those fruits.      Constraints  1 \leq K \leq N \leq 1000  1 \leq p_i \leq 1000  All values in input are integers.         Input Input is given from Standard Input in the following format:  N  K  p_1  p_2  \ldots  p_N       Output Print an integer representing the minimum possible total price of fruits.        Sample Input 1 5 3
50 100 80 120 80      Sample Output 1 210  This shop sells Fruit 1 , 2 , 3 , 4 , and 5 for 50 yen, 100 yen, 80 yen, 120 yen, and 80 yen, respectively.  The minimum total price for three kinds of fruits is 50 + 80 + 80 = 210 yen when choosing Fruit 1 , 3 , and 5 .       Sample Input 2 1 1
1000      Sample Output 2 1000

Solution (Python):
N, K = list(map(int, input().split(' ')))
P = sorted(map(int, input().split(' ')))

ans = sum(P[:K])
print(ans)

Solution (Python):
N, K = map(int, input().split())
p = list(map(int, input().split()))

cost = 0
for i in range(K):
    cost += min(p)
    p.remove(min(p))
print(cost)

Solution (Python):
N,K = map(int,input().split())
price = list(map(int,input().split()))
priceN = sorted(price)
total = 0
for i in range(K):
  total += priceN[i]
print(total)

Solution (Python):
N, K = map(int, input().split())
P = [int(x) for x in input().split()]
P.sort()
i = 0
k = 0

for j in P:
    if k == K:
        break
    i += j
    k += 1

print(i)

Solution (Python):
n,k = input().split()
k = int(k)

p = [int(s) for s in input().split()]
p.sort()


p2 = p[0:k]

s = sum(p)

print(sum(p2))

Solution (Python):
def main():
    N, K = map(int, input().split())
    
    p = [int(i) for i in input().split()]
    p.sort()
    print(sum(p[:K]))


if __name__ == "__main__":
    main()

Solution (Python):
def main():
    N, K = map(int, input().split())
    p = list(map(int, input().split()))
    p.sort()
    print(sum(p[:K]))


if __name__ == "__main__":
    main()

Solution (Python):
n, k = map(int, input().split())
price = list(map(int, input().split()))
price = sorted(price)
print(sum(price[:k]))

Solution (Python):
N = list(map(int,input().split()))
value = list(map(int,input().split()))
sum = 0
newValue = sorted(value)
for i in range(N[1]):
    sum = sum + newValue[i]
print(sum)

Solution (Python):

n, k = list(map(int, input().split()))
p = list(map(int, input().split()))
p.sort()
print(sum(p[:k]))

Solution (Python):
n ,k = list(map(int, input().split()))
p_list = list(map(int,input().split()))

p_list.sort()
ans = sum(p_list[0:k])
print(ans)

Solution (Python):
n,k = map(int,input().split())
p = list(map(int,input().split()))
p.sort(key=int)
money = 0
for i in range(k):money += p[i]
print(money)

Solution (Python):
n,k = map(int,input().split())
p = list(map(int,input().split()))
p.sort(key=int)
money = 0
for i in range(k):
    money += p[i]
print(money)

Solution (Python):
import sys
sys.setrecursionlimit(10**8)
def line_to_int(): return int(sys.stdin.readline())
def line_to_each_int(): return map(int, sys.stdin.readline().split())
def line_to_list(): return list(map(int, sys.stdin.readline().split()))
def line_to_list_in_iteration(N): return [list(map(int, sys.stdin.readline().split())) for i in range(N)]






n, k = line_to_each_int()
p = line_to_list()

p = sorted(p)
ans = 0
for i in range(k):
    ans += p[i]
print(ans)

Solution (Python):
n,k = map(int,input().split())
p = map(int,input().split())

a = sorted(p)
print(sum([a[i] for i in range(k)]))

Solution (Python):
n, k = map(int, input().split())
p = list(map(int, input().split()))
p.sort()

price = 0

for i in range(k):
    price += p[i]
    
print(price)

Solution (Python):
_, k = list(map(int, input().split()))
print(sum(sorted(list(map(int, input().split())))[0:k]))

Solution (Python):
n, k = map(int, input().split())

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


l.sort()

print(sum(l[0:k]))

Solution (Python):
n,k = map(int,input().split())
p = sorted(map(int,input().split()))


print(sum(p[:k]))

Solution (Python):
N, K = map(int, input().split())
p = list(map(int, input().split()))
p.sort()
p = p[:K]
print(sum(p))

Solution (Python):
N,K=map(int,input().split())
print(sum(sorted(list(map(int,input().split())))[:K]))

Solution (Python):
n,k = map(int,input().split())
a = sorted(list(map(int,input().split())))
print(sum(a[:k]))

Solution (Python):
import sys
def LI(): return list(map(int, sys.stdin.buffer.readline().split()))
def I(): return int(sys.stdin.buffer.readline())
def LS(): return sys.stdin.buffer.readline().rstrip().decode('utf-8').split()
def S(): return sys.stdin.buffer.readline().rstrip().decode('utf-8')
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def LSR(n): return [LS() for i in range(n)]
def SRL(n): return [list(S()) for i in range(n)]
def MSRL(n): return [[int(j) for j in list(S())] for i in range(n)]
mod = 10 ** 9 + 7

N, K = LI()
P = LI()


ans = 0
P.sort()
for i in range(K):
    ans += P[i]
print(ans)

Solution (Python):
n,k=map(int,input().split())
P=sorted(list(map(int,input().split())))
print(sum(P[:k]))

Solution (Python):
n,k = map(int,input().split(" "))
plist = list(map(int,input().split(" ")))

plist.sort()

ans = 0
for i in range(k):
    ans += plist[i]
print(ans)

Solution (Python):
a,b=map(int,input().split())

c=list(map(int,input().split()))
c.sort()


sum=0
for i in range(b):
    sum+=c[i]

print(sum)

Solution (Python):
N,K=map(int,input().split())
l=list(map(int,input().split()))
l.sort()
total=0
for i in range(K):
  total+=l[i]
print(total)

Solution (Python):
n, k = list(map(int,input().split()))
p = list(map(int,input().split()))

p.sort()
print(sum(p[:k]))

Solution (Python):
N, K = map(int, input().split())
p = list(map(int, input().split()))
	
p.sort()
count = 0
for num in range(K):
	count += p[num]

print(count)

Solution (Python):
N, K = map(int, input().split())
P = list(map(int, input().split()))
P.sort()
print(sum(P[:K]))

Solution (Python):
n,k=map(int,input().split())
p = sorted(list(map(int,input().split())))
print(sum(p[:k]))

Solution (Python):
k, n = map(int,input().split())
price = list(map(int,input().split()))
price.sort()

print(sum(price[0:n]))

Solution (Python):
n,k = map(int,input().split())
a = list(map(int,input().split()))
list.sort(a)
print(sum(a[0:k]))

Solution (Python):
N, K = map(int, input().split())
P = sorted(list(map(int, input().split())))
print(sum(P[:K]))

Solution (Python):
N,K = map(int, input().split())
p = list(map(int,input().split()))

p.sort()
ans = 0

for i in range(K):
  ans += p[i]

print(ans)

Solution (Python):
n, k = list(map(int, input().split()))
p = list(map(int, input().split()))
ps = sorted(p)
print(sum(ps[:k]))

Solution (Python):
def main():
  N, K = map(int, input().split())
  p = list(map(int, input().split()))
  
  p.sort()
  
  print(sum(p[:K]))
  
  
  
  
main()

Solution (Python):
N, K = map(int, input().split())
P = list(map(int, input().split()))
P.sort()
print(sum(P[:K]))

Solution (Python):
n,k = map(int, input().split())
p = list(map(int, input().split()))

p.sort()

ans = 0
for i in range(k):
  ans += p[i]
print(ans)

Solution (Python):
n,k = map(int,input().split())
v = list(map(int,input().split()))
v.sort()
print(sum(v[:k]))

Solution (Python):
L, R = input().split()
huga = list(map(int, input().split()))
i=0
gou=0

huga.sort()
for a in range(int(R)):
    gou=gou+huga[i]
    i+=1
print(gou)

Solution (Python):
n,k =map(int,input().split())
amountList=list(map(int,input().split()))
amountList.sort()
sum =0
for num in range(k):
  sum += amountList[num]

print(sum)

Solution (Python):
a,b = map(int,input().split())
arr = list(map(int,input().split()))
arr.sort()
print(sum(arr[:b]))

Solution (Python):
n, k = list(map(int, input().split()))
p = list(map(int, input().split()))
p.sort()
print(sum(p[:k]))

Solution (Python):
from math import floor,ceil,sqrt,factorial,log
from collections import Counter, deque
from functools import reduce
import numpy as np
import itertools
def S(): return input()
def I(): return int(input())
def MS(): return map(str,input().split())
def MI(): return map(int,input().split())
def FLI(): return [int(i) for i in input().split()]
def LS(): return list(MS())
def LI(): return list(MI())
def LLS(): return [list(map(str, l.split() )) for l in input()]
def LLI(): return [list(map(int, l.split() )) for l in input()]
def LLSN(n: int): return [LS() for _ in range(n)]
def LLIN(n: int): return [LI() for _ in range(n)]

N,K = MI()
P = LI()

P = sorted(P)

ans = sum(P[:K])

print(ans)

Solution (Python):
def main():
  n,k = list(map(int, input().split()))
  p = list(map(int, input().split()))
  p.sort()
  p2 = p[:k]
  print(sum(p2))
    
    
    
 
if __name__ == '__main__':
  main()

Solution (Python):
NN = input().split()
N = int(NN[0])
K = int(NN[1])
LL = input().split()
list1 =[]
for i in LL:
  list1.append(int(i))
list1.sort()

total = 0
for i in range(K):
  total += list1[i]
print(total)

Solution (Python):
n,k = map(int,input().split())
p = list( map(int,input().split()) )

p.sort()
ans = 0
for i in range(k):
  ans += p[i]
print(ans)

Solution (Python):
n,k = map(int,input().split())
p = sorted(list(map(int,input().split())))
total = 0
for i in range(k):
  total += p[i]
print(total)

Solution (Python):
n,k=map(int,input().split())
ar=list(map(int,input().split()))
ar.sort()
ans=0
for i in ar:
  if(k==0):
    break
  ans+=i
  k-=1
print(ans)

Solution (Python):
N,K = map(int,input().split())
p = list(map(int,input().split()))
p.sort()
ans = 0
for i in range(K):
    ans += p[i]
print(ans)

Solution (Python):
n, k = map(int, input().split())
print(sum(sorted(list(map(int, input().split())))[:k]))

Solution (Python):
N, K = map(int, input().split())
p = sorted(map(int, input().split()))
total = 0
for i in range(K) :
    total += p[i]
print(total)

Solution (Python):
n, k = map(int, input().split())
p = list(map(int, input().split()))
p.sort()
print(sum(p[:k]))

Solution (Python):
N, K = map(int, input().split())
p = list(map(int, input().split()))
p.sort()
result = 0
for i in range(K):
    result += p[i]
print(result)

Solution (Python):
N, K = map(int, input().split()) 

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

list.sort(P)

from itertools import accumulate
ans = list(accumulate(P))

print(ans[K-1])

Solution (Python):
a,b = map(int,input().split())
l = list(map(int,input().split()))
m = sorted(l,reverse=False)
z=0
for i in range(b):
	z=z+m[i]
print(z)

Solution (Python):
n, k = map(int, input().split())
prices = sorted(map(int, input().split()))
print(sum(prices[:k]))

Solution (Python):
n,k = map(int, input().split())

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

p_list.sort()



pricelist = p_list[:k]
pricesum = 0
for i in pricelist:
  pricesum += i

print(pricesum)

Solution (Python):
n, k = map(int, input().split())
p = list(map(int, input().split()))

assert(len(p) == n)

p.sort()

print(sum(p[:k]))

Solution (Python):
n, k = map(int, input().split())
p = list(map(int, input().split()))

p.sort()
ans = 0
for i in range(0,k):
    ans =  ans + p[i]

print(ans)

Solution (Python):
N, K = map(int,input().split())
p = list(map(int,input().split()))
p.sort()
print(sum(p[:K]))

Solution (Python):
n,k = map(int,input().split())
price = list(map(int,input().split()))
price.sort()
ans = 0
for i in range(k):
    ans += price[i]
print(ans)

Solution (Python):
N,K = map(int,input().split())
P = sorted(map(int,input().split()))
result = 0
for i in range(K):
	result += P[i]
print(result)

Solution (Python):
N, K = map(int, input().split())
p = list(map(int, input().split()))

p.sort()
print(sum(p[:K]))

Solution (Python):
N, K = map(int,input().split())
P = list(map(int, input().split()))
P.sort()
print(sum(P[:K]))

Solution (Python):
import numpy as np

N, K = map(int, input().split())
p = [int(x) for x in input().split()]

p_sorted = np.sort(p)
sum_min = np.sum(p_sorted[0:K])

print(sum_min)

Solution (Python):
N, K = map(int, input().split())
p = sorted(list(map(int, input().split())))
print(sum(p[:K]))

Solution (Python):
import itertools
import math
import fractions
import functools
import copy
from collections import deque
from functools import reduce
from decimal import Decimal


def main():

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

    p.sort()
    result = 0
    for i in range(k):
        result += p[i]
    print(result)



if __name__ == '__main__':
    main()

Solution (Python):
N, K = map(int, input().split(" "))
p = list(map(int, input().split(" ")))
 
p.sort()
print(sum(p[:K]))

Solution (Python):
n,k=map(int,input().split())
l=list(map(int,input().split()))
l.sort()
print(sum(l[:k]))

Solution (Python):
N ,K = map(int,input().split())
p = list(map(int,input().split()))
p = sorted(p)
x = sum(p[: K])
print(x)

Solution (Python):
N, K = map(int, input().split()) 
P = [int(x) for x in input().split()]
P.sort()
print(sum(P[0:K]))

Solution (Python):
n, k = map(int, input().split())
p = list(map(int,input().split()))

p.sort()
list = []

for i in range(k):
    list.append(p[i])
    
print(sum(list))

Solution (Python):
def main():
    entrada = list(map(int, input().split()))
    frutas = list(map(int, input().split()))
    frutas.sort()
    suma = 0
    for i in range(entrada[1]):
        suma = suma + frutas[i]

    print(suma)


if __name__ == "__main__":
    main()

Solution (Python):
n, k = map(int, input().split())
p=list(map(int, input().split()))
p.sort()
ans=0
for i in range(k):
    ans += p[i]
print(ans)

Solution (Python):
n, k = map(int, input().split())
p = [int(i) for i in input().split()]
p.sort()
ans = sum(p[0:k])
print(ans)

Solution (Python):
x,n = map(int, input().split())
arr = sorted(list(map(int,input().split())))
ans=0
for i in range(n):
    ans+=arr[i]
print(ans)

Solution (Python):
N, K = map(int, input().split())
P = list(map(int,input().split()))
P.sort()
P_ = P[:K]
print(sum(P_))

Solution (Python):
N, K = map(int, input().split())
p = list(map(int, input().split()))
print(sum(sorted(p)[:K]))

Solution (Python):
N,K = map(int,input().split())
p = list(map(int,input().split()))
p.sort()
print(sum(p[:K]))

Solution (Python):
N,K=list(map(int,input().split()))
P=list(map(int,input().split()))
P.sort()
price=0
for i in range(K):
	price+=P[i]
print(price)

Solution (Python):
N,K=map(int,input().split())
P=list(map(int,input().split()))

P.sort()
price=0
for i in range(K):
  price+=P[i]
  
print(price)

Solution (Python):
N, K = map(int ,input().split())
p = list(map(int ,input().split()))

p.sort()
n = sum(p[0:K])

print(n)

Solution (Python):
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,copy,functools
import time,random,resource

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 list(map(int, sys.stdin.readline().split()))
def LLI(): return [list(map(int, l.split())) for l in sys.stdin.readlines()]
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 pe(s): return print(str(s), file=sys.stderr)
def JA(a, sep): return sep.join(map(str, a))
def JAA(a, s, t): return s.join(t.join(map(str, b)) for b in a)


def main():
    n,k = LI()
    a = sorted(LI())

    return sum(a[:k])


print(main())

Solution (Python):
N, K = map(int, input().split())
P = sorted(list(map(int, input().split())))

ans = 0
for i in range(K):
    ans += P[i]

print(ans)

Solution (Python):
n,k = map(int, input().split())
p = sorted(list(map(int, input().split())))
print(sum(p[:k]))

Solution (Python):
n,k = map(int,input().split())
p = list(map(int,input().split()))

p.sort()

ans = 0

for i in range(k):
	ans += p[i]

print(ans)

Solution (Python):
N, K = [int(x) for x in input().split()]
P = sorted([int(x) for x in input().split()])
ans = 0
for i in range(K):
  ans += P[i]
print(ans)

Solution (Python):
N,K = map(int,input().split())
print(sum(sorted(list(map(int,input().split())))[:K]))

Solution (Python):
N, K = map(int, input().split())
A = sorted(map(int, input().split()))
print(sum(A[:K]))

Solution (Python):

def input2():
	return map(int,input().split())


def input_array():
	return list(map(int,input().split()))
  
n,k=input2()
P=input_array()
P.sort()
count=0
for i in range(k):
	count+=P[i]
print(count)

Solution (Python):
N,K = map(int, input().split())
p = list(map(int, input().split()))
p_as = sorted(p)
result = 0
for i in range (K):
    result += p_as[i]
print(result)

Solution (Python):
n,k=map(int,input().split())
p=sorted(list(map(int,input().split())))
print(sum(p[:k]))

Solution (Python):
n,k=map(int,input().split())
p=list(map(int,input().split()))

count=0
p.sort()
for i in range(k):
  count+=p[i]
  
print(count)

Solution (Python):
N, K = (int(i) for i in input().split())
p = [int(i) for i in input().split()]

sp = sorted(p)
print(sum(sp[:K]))

Solution (Python):
N, K = map(int, input().split())
p = list(map(int, input().split()))

m = []
for i in range(K):
    a = min(p)
    m.append(a)
    p.remove(a)

print(sum(m))

Solution (Python):
n, k = map(int,input().split())
p = list(map(int,input().split()))

p_min = []
for i in range(k):
    a = min(p)
    p_min.append(a)
    p.remove(a)

print(sum(p_min))

Solution (Python):
a,b= input().split(" ")
list1 = input()
x = [int(i) for i in list1.split()]
x = sorted(x)
sum = 0
for i in range(int(b)):
    
    sum += x[i]

print(sum)

Solution (Python):
N, K = map(int, input().split())
p = sorted(list(map(int, input().split())))

print(sum(p[:K]))

Solution (Python):
N, K = map(int, input().split())
p = list(map(int,input().split()))
p.sort()
print(sum(p[:K]))

Solution (Python):
n,k=map(int,input().split())
l=sorted(list(map(int,input().split())))
print(sum(l[0:k]))

Solution (Python):
def main():
    N, K = map(int, input().split())
    P = map(int, input().split())
    print(sum(sorted(P)[:K]))


if __name__ == '__main__':
    main()

Solution (Python):
n,k=map(int,input().split())
P=list(map(int,input().split()))
P.sort()
ans=0
for i in range(k):
  ans+=P[i]
print(ans)

Solution (Python):
N,K = map(int, input().split())
p = list(map(int, input().split()))

p.sort()

print(sum(p[0:K]))

Solution (Python):
n, k = input().split(" ")
n = int(n)
k = int(k)
a = [int(x) for x in input().split(" ")]
a.sort()
ans = 0
for i in range(k):
 ans += int(a[i])
print(ans)

Solution (Python):
N, K = map(int, input().split())
P = list(map(int, input().split()))
print(sum(sorted(P)[:K]))

Solution (Python):
def main():
    n,k = map(int,input().split())
    p = [int(i) for i in input().split()]
    p.sort()
    print(sum(p[:k]))
main()

Solution (Python):
A,B = map(int,input().split())
L = list(map(int,input().split()))
L.sort()
print(sum(L[:B]))

Solution (Python):
n, k = map(int, input().split())
p = list(map(int, input().split()))

p.sort()
print(sum(p[:k]))

Solution (Python):
N, K = map(int, input().split())
P = [int(p) for p in input().split()]
ans = 0

for i in range(K):
  ans += min(P)
  P.remove(min(P))

print(ans)

Solution (Python):
n, k = map(int, input().split())
p = list(map(int, input().split()))

p.sort()

ans = sum(p[:k])
  
print(ans)

Solution (Python):
n, k = map(int, input().split())
p = list(map(int, input().split()))

p.sort()

ans = 0
for i in range(k):
  ans += p.pop(0)
  
print(ans)

Solution (Python):
N, K = map(int, input().split())
p = list(map(int, input().split()))

print(sum(sorted(p)[:K]))

Solution (Python):
a = input().split()


b = list(map(int, input().split()))
b.sort()

sum = 0

for i in range(int(a[1])):
    sum += b[i]

print(sum)

Solution (Python):
n, k = map(int, input().split())
p = sorted(list(map(int, input().split())))
print(sum(p[0:k]))

Solution (Python):
N,K = map(int,input().split())
p = list(map(int,input().split()))
p.sort()
print(sum(p[:K]))

Solution (Python):
n,k = list(map(int, input().split()))
p = list(map(int, input().split()))
p.sort()
min_price = sum(p[:k])
print(min_price)

Solution (Python):
n, k = map(int,input().split())
p = list(map(int,input().split()))

p.sort()
print (sum([p[i] for i in range(k)]))

Solution (Python):
n,m=map(int,input().split())
arr=sorted(list(map(int,input().split())))
print(sum(arr[:m]))

Solution (Python):
N, K = list(map(int, input().split()))
P = list(map(int, input().split()))

P.sort()
print(sum(P[:K]))

Solution (Python):
n, k = map(int, input().split())
p = list(map(int, input().split()))
p = sorted(p)
ans = 0
for i in range(k):
    ans += p[i]
print(ans)

Solution (Python):
n,k=map(int,input().split())

p=list(map(int,input().split()))
p.sort()
p1=p[:k]
print(sum(p1))

Solution (Python):
n, k = map(int, input().split(' '))
fruits = list(map(int, input().split(' ')))
fruits.sort()
print(sum(fruits[:k]))

Solution (Python):
N, K = map(int, input().split())
p = list(map(int, input().split()))
q = sorted(p)
s = 0

for i in range(0, K):
    s += q[i]

print(s)

Solution (Python):
n,k = map(int,input().split())
pi = list(map(int,input().split()))
pi.sort()
print(sum(pi[:k]))

Solution (Python):
N, K = map(int, input().split())
p = list(map(int, input().split()))
result=0
p.sort()
for i in range(K):
    result += p[i]
print(result)

Solution (Python):
n,k = map(int,input().split())
p = list(map(int,input().split()))
p.sort()
print(sum(p[:k]))

Solution (Python):
n,k=map(int,input().split())
lp=list(map(int,input().split()))
lp.sort()
nlp=lp[:k]
s=0
for x in nlp:
    s += x
    
print(s)

Solution (Python):



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


p.sort()
s = 0
for i in range(k):
    s += p[i]
print(s)

Solution (Python):
sum = 0
n, k = map(int, input().split())
p = list(map(int, input().split()))
p.sort()
for i in range(k):
    sum += p[i]
print(sum)

Solution (Python):
N,K = map(int,input().split())
p = map(int,input().split())

t = sorted(p,reverse = False)

ans = 0
for i in range(K):
    ans += t[i]
print(ans)

Solution (Python):

def submit():
    n, k = map(int, input().split())
    p = list(map(int, input().split()))
    p.sort()
    print(sum(p[:k]))


submit()

Solution (Python):
N, K = map(int, input().split())
P = sorted([int(i) for i in input().split()])
print(sum(P[:K]))

Solution (Python):
N,K=map(int,input().split())
p=list(map(int,input().split()))
sum=0
for i in range(K):
    p=sorted(p)
    sum+=p[0]
    p=p[1:N]
print(sum)

Solution (Python):
N,K = map(int, input().split())
P=sorted(list(map(int, input().split())),reverse=False)
print(sum(P[:K]))

Solution (Python):
N,K = map(int,input().split())
a = list(map(int,input().split()))

a.sort()

print(sum(a[:K]))

Solution (Python):
import sys
readline = sys.stdin.readline
sys.setrecursionlimit(10**8)
mod = 10**9+7

INF = 10**18
eps = 10**-7

N,K = map(int,readline().split())
p = list(map(int,readline().split()))
p.sort()

print(sum(p[:K]))

Solution (Python):
N,K=map(int,input().split())
p=list(map(int,input().split()))
p.sort()
ans=0
for i in range(K):
    ans+=p[i]
print(ans)

Solution (Python):
n, k = map(int, input().split())
p = list(map(int, input().split()))
p.sort()
ans = p[0]
for i in range(1, k):
    ans += p[i]
print(ans)

Solution (Python):
N,K = map(int,input().split())

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

ld = sorted(fruits)[:K]

print(sum(ld))

Solution (Python):
N,K=map(int,input().split())
p=sorted(list(map(int,input().split())))
print(sum(p[:K]))

Solution (Python):
N,K=map(int,input().split())
p=sorted(list(map(int,input().split())))
print(sum(p[:K]))

Solution (Python):
n,k = map(int,input().strip().split())
fruits = list(map(int, input().strip().split()))
fruits.sort()
print(sum(fruits[:k]))

Solution (Python):
N, K = map(int, input().split(' '))
P = sorted(list(map(int, input().split(' '))))

ans = 0
for i in range(K):
    ans += P[i]
print(ans)

Solution (Python):
N, K = map(int, input().split())
p = map(int, input().split())
sorted = sorted(p)
print(sum(sorted[:K]))

Solution (Python):
N,K=map(int,input().split())
p=[int(x) for x in input().split()]
p=sorted(p)
ans=0
for i in range(K):
    ans+=p[i]
print(ans)

Solution (Python):
n, k = map(int, input().split())
lis = list(map(int, input().split()))

lis.sort()
ans = 0
for i in range(k):
    ans += lis[i]

print(ans)

Solution (Python):
n,k=map(int,input().split())
p=list(map(int,input().split()))
p2=sorted(p)
print(sum(p2[:k]))

Solution (Python):
n, k = list(map(int, input().split()))

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

prices.sort()

purchase_price = sum(prices[0:k])

print(purchase_price)

Solution (Python):
N,K=map(int,input().split())
list = [int(i) for i in input().split()]
list_sorted = sorted(list)
money=0
count=0

for j in range(1,K+1):
    money+=list_sorted[count]
    count+=1

print(money)

Solution (Python):
n,k = map(int, input().split())
p = list(map(int, input().split()))

for i in range(len(p)):
    for j in reversed(range(i+1,len(p))):
        if p[j] < p[j-1]:
            p[j-1],p[j] = p[j],p[j-1]

print(sum(p[:k]))

Solution (Python):

n,k=map(int,input().split())
pricelist=list(map(int,input().split()))
pricelist.sort()
sumprice=0
for i in range(k):
  sumprice+=pricelist[i]
print(sumprice)

Solution (Python):
n, k = map(int, input().split())
p = [int(x) for x in input().split()]
p.sort()

sum = 0
for i in range(k):
    sum += p[i]

print(sum)

Solution (Python):
number = input().split(" ")
N = int(number[0])
K = int(number[1])
 
list = []
numbers = input().split(" ")
for i in numbers:
    list.append(int(i))
list.sort()
 
a = 0
 
for i in range(K):
	a += int(list[i])
print(a)

Solution (Python):
n,k=map(int,input().split())
prices=list(map(int,input().split()))
prices.sort()
ans=sum(prices[:k])
print(ans)

Solution (Python):
n, k = map(int, input().split())
j=0
p=0
fruits= list(map(int, input().split()))
fruits.sort()
for j in range(k):
	p+=fruits[j]
print(p)

Solution (Python):
N, K = map(int, input().split())
p = map(int, input().split())

print(sum(sorted(p)[:K]))

Solution (Python):
n, k = [int(i) for i in input().split()]
p = [int(i) for i in input().split()]
p.sort()
print(sum(p[:k]))

Solution (Python):
N,K=map(int,input().split())
p=list(map(int,input().split()))
l=[]

p.sort()

for i in range(K):
  l.append(p[i])
print(sum(l))

Solution (Python):
n, k = map(int, input().split())

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

pa = sorted(p)

print(sum(pa[:k]))

Solution (Python):
a,b = map(int, input().split())
fruit = list(map(int, input().split()))
fruit2 = sorted(fruit,reverse=False)
sum = 0
for item in fruit2[0:b]:
	sum = sum + item

print(sum)

Solution (Python):
n,k = map(int,input().split())
p = list(map(int,input().split()))
p.sort()
print(sum(p[:k]))

Solution (Python):
n,k = map(int,input().split())
p = list(map(int,input().split()))
p.sort()
print(sum(p[:k]))

Solution (Python):
n,k = map(int,input().split())
p = list(map(int,input().split()))
p.sort()
print(sum(p[:k]))

Solution (Python):
n,k = map(int,input().split())
p = list(map(int,input().split()))
p.sort()
print(sum(p[:k]))

Solution (Python):
in_ = list(map(int, input().split(' ')))
N = in_[0]
K = in_[1]
p = list(map(int, input().split(' ')))
p.sort()
print(sum(p[0:K]))

Solution (Python):
from sys import stdin, stdout
read = stdin.readline
write = stdout.write
flush = stdout.flush
xr = range

def main():
  n,k = map(int,read().split())
  a = sorted(list(map(int,read().split())))
  write('{}\n'.format(sum(a[:k])))

if __name__ == "__main__":
  main()

Solution (Python):
from sys import stdin, stdout
read = stdin.readline
write = stdout.write
flush = stdout.flush
xr = range

def main():
	n,k = map(int,read().split())
	a = sorted(list(map(int,read().split())))
	write('{}\n'.format(sum(a[:k])))

if __name__ == "__main__":
	main()

Solution (Python):
from sys import stdin, stdout
read = stdin.readline
write = stdout.write
flush = stdout.flush
xr = range

def main():
	n,k = map(int,read().split())
	a = list(map(int,read().split()))
	a.sort()
	write('{}\n'.format(sum(a[:k])))

if __name__ == "__main__":
	main()

Solution (Python):
import sys
def input(): return sys.stdin.readline().strip()

def resolve():
    n,k=map(int, input().split())
    l=list(map(int,input().split()))
    print(sum(sorted(l)[:k]))
resolve()

Solution (Python):
import sys
def input(): return sys.stdin.readline().strip()

def resolve():
    n,k=map(int, input().split())
    l=list(map(int,input().split()))
    l.sort()
    print(sum(l[:k]))
resolve()

Solution (Python):
n,k=map(int,input().split())
lst=list(map(int,input().strip().split()))[:n]
lst.sort()
print(sum(lst[0:k]))

Solution (Python):
N, K = map(int, input().split())
values = [int(value) for value in input().split()]
values.sort()
ans = sum(values[:K])
print(ans)

Solution (Python):
line = [input() for i in range(2)]

status = [int(x) for x in line[0].split()]
fruits = [int(x) for x in line[1].split()]

status
fruits = sorted(fruits)

i = 1
total = 0
for fruit in fruits:
    i += 1
    total += int(fruit)
    if int(status[1]) < i:
        break
print(total)

Solution (Python):
(N, K) = input().split(' ')
a = list(map(int, input().split()))
a.sort()
x = 0
for i in range(int(K)):
    x += int(a[i])
print(x)

Solution (Python):
n,k = map(int, input().split())
import numpy as np
P = [int(i) for i in input().split()]
P.sort()
P = np.array(P)
print(P[:k].sum())

Solution (Python):
n, k = map(int, input().split())
plist = list(map(int, input().split()))

plist.sort()
ans = 0
for i in range(k):
    ans += plist[i]

print(ans)

Solution (Python):
N, K = map(int,input().split())
A = list(map(int,input().split()))
A.sort()
print(sum(A[:K]))

Solution (Python):
import numpy as np

N, K = list(map(int, input().split()))
p = list(map(int, input().split()))

p = np.array(p)
p = np.sort(p)

sum = 0
for _ in range(K):
    sum += p[_]

print(sum)

Solution (Python):
n, k = (int(x) for x in input().split())
l = list(map(int, input().split()))
a = sum(sorted(l)[:k])
print(a)

Solution (Python):
N, K=map(int,input().split())

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

price2 = sorted(price)
i = 0
sum = 0
while (i < K):
  sum += price2[i]
  i += 1

print(sum)

Solution (Python):
n, k = map(int,input().split())
p = list(map(int, input().split()))
p.sort()
print(sum(p[:k]))

Solution (Python):
n,k = map(int, input().split())
l = list(map(int, input().split()))
l1 = sorted(l, reverse= False)
sum = sum(l1[0:k])
print(sum)

Solution (Python):
n, k = map(int,input().split())
p = list(map(int, input().split()))

p = sorted(p)
ans = 0

for i in range(k):
    ans += p[i]

print(ans)

Solution (Python):
n, k = map(int, input().split())
ps = sorted(list(map(int, input().split())))

print(sum(ps[:k]))

Solution (Python):
N,K = map(int, input().split())
p = list(map(int, input().split()))
new_p = sorted(p)
numbers = []
for i in range(K):
    numbers.append(new_p[i])
print(sum(numbers))

Solution (Python):
import sys
input = sys.stdin.readline

n, m = map(int, input().split())
print(sum(sorted(list(map(int, input().split())))[:m]))

Solution (Python):
n,k,*l=map(int,open(0).read().split());l.sort();print(sum(l[:k]))

Solution (Python):
n,k = map(int,input().split())
p = list(map(int,input().split()))
p.sort()
print(sum(p[0:k]))

Solution (Python):
n,k = map(int,input().split())

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

soma = 0

lista.sort()

for i in range(k):
    soma += lista[i]

print(soma)

Solution (Python):
n,k = map(int,input().split())
a = list(map(int,input().split()))
a.sort()
print(sum(a[:k]))