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):
import os
import sys
from io import BytesIO, IOBase


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





BUFSIZE = 8192


class FastIO(IOBase):
    newlines = 0

    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None

    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()

    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()

    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)


class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.write = lambda s: self.buffer.write(s.encode("ascii"))
        self.read = lambda: self.buffer.read().decode("ascii")
        self.readline = lambda: self.buffer.readline().decode("ascii")


sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)
input = lambda: sys.stdin.readline().rstrip("\r\n")



if __name__ == "__main__":
    main()

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

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

print(ans)

Solution (Python):
get=lambda:map(int,input().split())
lget=lambda:list(map(int,input().split()))

N,K=get()
p=lget()

p.sort()
ans=0

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

Solution (Python):
list = input().split(" ")
N=int(list[0])
K=int(list[1])

l = input().split(" ")
l_si_i = [int(s) for s in l]
l_si_i.sort()

sum=0
for i in range(K):
    sum=sum+l_si_i[i]

print(sum)

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

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()))
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 = sorted(p, key = int)
print(sum(p[:k]))

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

p.sort()
ans = 0
i = 0
while i < k:
  ans = ans + p[i]
  i += 1
print(ans)

Solution (Python):
if __name__=="__main__":
    
    N, K = map(int, input().split(' '))
    P = [None] * N
    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())
price = input().split()
price = [int(x) for x in price]
price.sort()
ans = 0
for x in range (K):
  ans += price[x]
print(ans)

Solution (Python):
import numpy as np

def main():
    args = input().rstrip().split(' ')
    N, K = int(args[0]), int(args[1])
    args = input().rstrip().split(' ')
    p = np.array([int(i) for i in args])
    
    p = np.sort(p)
    sum = 0
    for i in range(K):
        sum += p[i]
    print(sum)
    
if __name__ == "__main__":
    main()

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):
result = 0

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

price_list.sort()
result = sum(price_list[:K])
print(result)

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

p.sort()
count = 0

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

print(count)

Solution (Python):
from sys import stdin
import heapq 

N, K = map(int, input().split())
input_data = [int(x) for x in stdin.readline().strip().split(" ")]

heapq.heapify(input_data)
sumnum = 0
for k in range(K):
    sumnum += heapq.heappop(input_data)
print(sumnum)

Solution (Python):
x, y = map(int, input().split())
ar = list(map(int, input().split()))

ar = sorted(ar)
sum = 0
for i in range(y):
  sum += ar[i]
  
print(sum)

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())
p = list(map(int, input().split()))

p.sort()

value = 0

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

print(value)

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())
L = list(map(int,input().split()))
ans=0
S= sorted(L)
for i in range(k):
    ans += S[i]
print(ans)

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

p.sort()

for i in range(K):
    sum += p[j]
    j += 1

print(sum)

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

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

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

Solution (Python):


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

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

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

Solution (Python):
N,K = map(int,input().split())
p = list(map(int,input().split()))
ako = len(p)
p.sort()
nedan = 0
if (1<= K <= N <= 1000) and 1 <= ako <= 1000:
    for i in range(K):
        nedan += p[i]
print(nedan)

Solution (Python):
_, t = [int(x) for x in input().split()]
s = sorted([int(x) for x in input().split()])
c = 0
for i in range(t):
    c += s[i]
print(c)

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):
n, k = map(int, input().split())
A = sorted(list(map(int, input().split())))
ans = 0
for i in range(k):
  ans = ans + A[i]
print(ans)

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

N = int(N)
K = int(K)


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

nums = nums[:K]


print(sum(nums))

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()
p1 = p[:K]
print(sum(p1))

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

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

Solution (Python):
N, K = list(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=sorted(p)
print(sum(p[:K]))

Solution (Python):
import sys

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline

n, k, *p = map(int, read().split())

p = sorted(p)

print(sum(p[:k]))

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())
l=list(map(int,input().split()))
l.sort()
print(sum(l[0:K]))

Solution (Python):
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**5)

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

if __name__ == "__main__":
    main()

Solution (Python):
import heapq
nk = input()
allp = input()
nklis = nk.split(" ")
plis = allp.split(" ")
plis = [int(n) for n in plis]
n = int(nklis[0])
k = int(nklis[1])
print(sum(heapq.nsmallest(k, plis)))

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


p.sort()
sum = 0
for i in range(n[1]):
  sum += p[i]
  
print(sum)

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):
NK=list(map(int,input().split()))
N = NK[0]
K = NK[1]

nums=list(map(int,input().split()))
nums.sort()
sum=0

for k in range(K):
    sum+=nums[k]

print(sum)

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

print(ans)

Solution (Python):

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

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()
print(sum(p[:K]))

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

count = 0
for i in range(K):
    count += p[i]
print(count)

Solution (Python):
def IL():
    return list(map(int,input().split()))
    
N,K=IL()
fruits=IL()
fruits.sort()
ans=0
for k in range(K):
    ans+=fruits[k]

print(ans)

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):
N, K = map(int, input().split())
L = list(map(int, input().split()))
list.sort(L)
print(sum(L[0:K]))

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

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

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

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

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

ans = sum(P[0:k])
print(ans)

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

p = sorted(wklst)


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

print(rs)

Solution (Python):
select = list(map(int, input().split()))
goods  = list(map(int, input().split()))

sorted_goods = sorted(goods)
print(sum(sorted_goods[:select[1]]))

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

plist.sort()
plist = plist[0:K]
print(sum(plist))

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

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







ps = sorted(p)
print(sum(ps[:nk[1]]))

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()
sum = 0
for i in range(k):
    sum += p[i]

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 = sorted(list(map(int, input().split())))
print(sum(P[:K]))

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

Solution (Python):
import itertools
n,k=map(int,input().split())
p=list(map(int,input().split()))
p.sort()
cumsum = itertools.accumulate(p)
print(list(cumsum)[k-1])

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

ni.sort()
thum = 0

for i in range(k):
    thum += ni[i]

print(thum)

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

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

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

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

p.sort()

ans = 0

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

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):





import math
import fractions
import sys
import bisect
import heapq  
import collections
from collections import Counter
from collections import deque
import pprint

sr = lambda: input()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

"""nを素因数分解"""
"""2以上の整数n => [[素因数, 指数], ...]の2次元リスト"""
def factorization(n):
    arr = []
    temp = n
    if n == 1:
        return arr

    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr


def power(a,n,mod):
    x = 1
    while n:
        if n & 1:
            x *= a % mod
        n >>= 1
        a *= a % mod
    return x % mod


def kaijo(n, l, mod):
    if n == 0:
        return 1
    a = n
    tmp = n-1
    while(tmp >= l):
        a = a*tmp%mod
        tmp -= 1
    return a

inf = 10**18
mod = 10**9+7

n, k = lr()
p = lr()

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

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

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

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

for i in range(k):
    nmin = min(p)
    sum += nmin
    p.remove(nmin)

print(sum)

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

Solution (Python):
n,k=[int(i) for i in input().split()]
p_list=[int(i) for i in input().split()]

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

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

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

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

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

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

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

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

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

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

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

a.sort()
x = 0
for i in range(K):
    x = x + a[i]
    

print(x)

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

sum_money = 0
for i in range(K):
  sum_money = sum_money + p_list[i]

print(sum_money)

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

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

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

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

ans = sum(price[:k])

print(ans)

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

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

S = sorted(map(int, input().split()))
sum = 0
for i in range(K):
    sum += S[i]
print(sum)

Solution (Python):
n, k = map(int, input().split())
l = [ int(x) for x in input().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[: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())
pn = list(map(int,input().split()))

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

print(ans)

Solution (Python):
tmp_nk = input().split()
n = int(tmp_nk[0])
k = int(tmp_nk[1])

tmp_p = input().split()
p_list = [int(x) for x in tmp_p]

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

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

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

p_sort = sorted(p)
ans = 0

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

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

num_list = [i for i in map(int,input().split())]
num_list.sort()

total = sum(num_list[:K])
print(total)

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())
l=list(map(int,input().split()))
l.sort()
z=0
for i in range(k):
  z+=l[i]
print(z)

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

Solution (Python):
n = input().split()
n = [int(i) for i in n]
m = input().split()
m = [int(i) for i in m]

ans = []
for i in range(n[1]):
    a = min(m)
    ans.append(a)
    m.remove(a)
    
print(sum(ans))

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

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

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

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

Solution (Python):
a,b = map(int,input().split())
c = input().split()
c = [int(s) for s in c]
c.sort()
x = 0
for i in range(b):
    x = x + c[i]
print(x)

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

list.sort(p_list)

amount = 0
for i in range(K):
    amount += p_list[i]
print(amount)

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

p.sort()

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

print(ans)

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

p.sort()

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

print(int(sum))

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

Solution (Python):
import re

n, k = input().strip().split(' ')
p = [int(x.strip()) for x in input().strip().split(' ')]
p.sort()
sum = 0
for i in range(0, int(k)):
  sum = sum + p[i]
print(sum)

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

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

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

p.sort()

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

print(c)

Solution (Python):









import os
import sys




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())
*p, = sorted(map(int, input().split()))

ans = sum(p[:k])

print(ans)

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

Solution (Python):

import collections
import sys
import copy
import re


def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int, sys.stdin.readline().rstrip().split()))
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())


def main():
    N, K = LI()
    pArray = LI()
    pArray.sort()

    count = 0
    for i in range(K):
        count += pArray[i]

    print(count)


if __name__ == '__main__':
    main()

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

    t.sort()
    print(sum(t[0:k]))

if __name__ == '__main__':
    main()

Solution (Python):
def main():
    n, k = map(int, input().split())
    p_list = [int(_) for _ in input().split()]

    p_list = sorted(p_list)

    f_list = []
    for i in range(k):
        f_list.append(p_list[i])

    out = sum(f_list)
    
    print(out)

main()

Solution (Python):
_,k=map(int,input().split())
a = sorted(int(i) for i in input().split())
print(sum(a[:k]))

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

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

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

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

Solution (Python):
in1 = list(map(int, input().split()))
in2 = list(map(int, input().split()))

in2.sort()
sum = 0
for i in range(in1[1]):
  sum += in2[i]

print(sum)

Solution (Python):
a, b = map(int, input().split())
c = sorted(map(int, input().split()))
print(sum(c[:b]))

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

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())

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




P.sort()



kaimono = 0
count = 1
for p in P:
  if count > k:
    break
  
  kaimono += P[count-1]
  count = count + 1
  
print(kaimono)

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())))
print(sum(p[0:k]))

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

A.sort()

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

Solution (Python):
N,K = map(int,input().split())
p = list(map(int,input().split()))
p = sorted(p)
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 = map(int,input().split())
p = list(map(int,input().split()))
p.sort()
count = 0
for i in p[:k]:
    count += i
    
print(count)

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

Solution (Python):
import heapq

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

p1 = heapq.nsmallest(k, p)

print(sum(p1))

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_list = [int(item) for item in input().split()]

sorted_list = sorted(p_list)
print(sum(sorted_list[:K]))

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

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

A.sort()
B = A[:K]
print(sum(B))

Solution (Python):
class int(int):  
  def times(self, callback):
    for times in range(0,self):
      callback()

class list(list):
  def maps(self, callback):
    return list(map(callback, self))

  def each(self, callback):
    list(map(callback, self))
    return self

  
  def each_with_index(self,callback):
    list(map(callback, self, range(0,len(self))))
    return self

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

p = list(input().split())

def convert(arg):
    return int(arg)
nums = p.maps(convert)

nums.sort()
print(sum(nums[0:k]))

Solution (Python):
line = input().split(" ")

fruit_obj = int(line[0])
buy_obj = int(line[1])

line2 = input().split(" ")

urine = []
for j in range(len(line2)):
    urine.append(int(line2[j]))

urine.sort()

price = 0
for i in range(buy_obj):
    price = price + int(urine[i])

print(price)

Solution (Python):
import sys

input = sys.stdin.readline

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

p = sorted(p)

print(sum(p[:K]))

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

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

list.sort(P)

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

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

Solution (Python):
n, k = [int(c) for c in input().strip().split()]
p = [int(c) for c in input().strip().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
count = 0
for i in P:
    if count >= K:
        break
    ans += i
    count += 1

print(ans)

Solution (Python):
N , K = map(int,input().split())
p = list(map(int,input().split()))
p = sorted(p)
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 math
n,k = input().split(" ")
p = input().split(" ")
a = []
for i in p:
  a.append(int(i))
a.sort()
sum = 0
k = int(k)
for j in range(k):
  sum = sum + a[j]

print(sum)

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

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

Solution (Python):
g, num = map(int, input().split())
price_list = list(map(int, input().split()))
price_list.sort()
gokei = 0
for i, _ in enumerate(range(num)):
    gokei += price_list[i]
print(gokei)

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

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

y = (sorted(x)[:K])

print(sum(y))

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

for x in range(k):
    kei += m[x]

print(kei)

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 = [int(x) for x in input().split()]
newlist = sorted(p)

sum = 0
for i in range(K):
    sum += newlist[i]

print(sum)

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

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())
pn = sorted(list(map(int, input().split())))
ans = 0
for i in range(K):
	ans += pn[i]
	
print(ans)

Solution (Python):
N, K= map(int, input().split())
L = [int(i) for i in input().split()]
L.sort()
ANS=0
for i in range(K):
    ANS=ANS+L[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):
n,k = map(int, input().split())
pn = list(map(int, input().split()))

pn2 = sorted(pn)
Ans = 0
for i in range(k):
    Ans = Ans + pn2[i]
print(Ans)

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

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

Solution (Python):

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

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




if __name__ == "__main__":
    main()

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

for k in range(0,K):
    count += p[k]

print(count)

Solution (Python):
n,k = map(int, input().split())
p = list(map(int, input().strip().split()))
sortlist = sorted(p)
sum = 0

for i in range(k):
    sum = sum + sortlist[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 = input().split()
k = int(k)
p = [int(e) for e in input().split()]
p.sort()
sum = 0
for num in range(k):
    sum += p[num]
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_1 = list(map(int,input().split()))
p_2 = sorted(p_1)
p_3 = p_2[:K]
print(sum(p_3))

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

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

Solution (Python):

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

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