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):
def main():
    N,K = map(int,input().split())
    p = list(map(int,input().split()))

    p.sort()
    money = 0
    for i in range(K):
        money += p[i]

    return money

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=input().split();
N=int(N);
K=int(K);
P=input().split();
P= [int(s) for s in P]
P.sort();
sum=0;
for i in range(K):
  sum=sum+P[i];
print(sum);

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

p.sort()
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_order = sorted(p)
ans = 0

p_ans = p_order[:k]
ans = sum(p_ans)
print(ans)

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

p.sort()


sum =0

for i, item in enumerate(p):
    if i== k:
        break
    sum += item

print(sum)

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

if __name__ == '__main__':
    main()

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

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

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

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

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

p2 = sorted(p)
ans = 0

for i in range(len(p2)):
    ans += p2[i]
    if i == k-1:
        break

print(ans)

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

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

Solution (Python):
_, K = map(int, input().split())
print(sum(sorted(map(int, input().split()))[: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):
import sys

sys.setrecursionlimit(10**7)
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))  
def LI2(): return list(map(int,sys.stdin.readline().rstrip()))  
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())  
def LS2(): return list(sys.stdin.readline().rstrip())  

N,K = map(int,S().split())
p = LI()
p = sorted(p)

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

print(ans)

Solution (Python):

from sys import stdin
from operator import itemgetter
from collections import deque, Counter
import math
import pprint
from functools import reduce


MOD = 1000000007
INF = float('inf')

def keta(kazu): 
    kazu_str = str(kazu)
    kazu_list = [int(kazu_str[i]) for i in range(0, len(kazu_str))]
    return kazu_list

def gcd(*numbers): 
    return reduce(math.gcd, numbers)

def combination(m,n): 
    
    if n > m:
        return 'すまん'
    return math.factorial(m) // (math.factorial(m-n) * math.factorial(n))

def pow_k(x,n):  
    if n == 0:
        return 1
    K = 1
    while n > 1:
        if n % 2 != 0:
            K *= x
        x *= x
        n //= 2
    return K * x
    
def main():
    n, k = [int(x) for x in stdin.readline().rstrip().split()]
    p = list(map(int,[int(x) for x in stdin.readline().rstrip().split()]))
    sort_p = sorted(p)
    print(sum(sort_p[0:k]))
main()

Solution (Python):
n, k = map(int, input().split())
line = input()
p_list = line.split(" ")
p_list = [int(p) for p in p_list]
p_list = sorted(p_list)
ans = 0

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

Solution (Python):
N ,K = map(int,input().split())
P = sorted(map(int,input().split()))
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 = sorted(p)
s = sum(p[:K])

print(s)

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

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

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

Solution (Python):
i = list(map(int, input().split()))
s = list(map(int, input().split()))

out=0
s = sorted(s)
for i in range(i[1]):
  out+=s[i]
print(out)

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

m.sort()

print(sum(m[:k]))

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

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

Solution (Python):
def linked_merge_sort(l): 
    if len(l) == 1:
        return
    q, r = divmod(len(l), 2)
    left = [l.pop() for _ in range(q)]
    right = [l.pop() for _ in range(q + r)]
    
    linked_merge_sort(left)
    linked_merge_sort(right)
    
    left.reverse()
    right.reverse()
    while left and right:
        if left[-1] <= right[-1]:
            l.append(left.pop())
        else:
            l.append(right.pop())
    while left:
        l.append(left.pop())
    while right:
        l.append(right.pop())
    return

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

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

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

sort = sorted(p)
s = 0

for i in range(k):
    s += sort[i]

print(s)

Solution (Python):
N, K = list(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):
num1,num2=map(int,input().split())
number=list(map(int,input().split()))
number.sort()
print(sum(number[:num2]))

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

p.sort()

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

print(ans)

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

p.sort()
cost = 0

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

print(cost)

Solution (Python):


import sys
import math


debug = False

def log(text):
    if debug:
        print(text)

def parse_input(lines_as_string = None):

    global debug
    lines = []
    if lines_as_string is None:
        debug = False
        
        
        lines.append(input())
        lines.append(input())
    else:
        debug = True
        lines = [e for e in lines_as_string.split("\n")][1:-1]

    (n, k) = [int(e) for e in lines[0].split(' ')]
    p = [int(e) for e in lines[1].split(' ')]

    return (n, k, p)


def solve(n, k, p):
    
    p.sort()
    result = sum(p[:k])
                
    return result    


def main():
    
    result = solve(*parse_input())
    if isinstance(result, list):
        for r in result:
            print("%s" % r, sep='')
    else:
        print("%s" % result, sep='')

if __name__ == '__main__':

    main()

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

P = sorted(P)


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

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

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

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

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

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

p.sort()

min = 0

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

print(min)

Solution (Python):
N,K=map(int,input().split(" "))
p=[int(_) for _ in 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 = 0
for i in range(K):
    ans = ans + p[i]

print(ans)

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

m.sort()
for _ in range(k):
  ans=ans+m[_]
  
print(ans)

Solution (Python):
N,K=map(int,input().split())
lst=list(map(int,input().split()))[:N]
lst.sort()
x=[]
for i in range(K):
    x.append(lst[i])
print(sum(x))

Solution (Python):
N,K = map(int,input().split())
prices = [int(x) for x in input().split()]

prices = sorted(prices)
account = 0

for i in range(K):
    account += prices[i]
    
print(account)

Solution (Python):

n, k = map(int, input().split())
price = list(map(int, input().split()))
sorted_price = sorted(price)

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

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

list.sort(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()

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

print(sum)

Solution (Python):
import itertools

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

ans = 0
for _ in range(K):
    min_index = p.index(min(p))
    minv = p.pop(min_index)
    ans += minv

print(ans)

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

A = p[0:K]
ans = sum(A)

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):
def main():
  N, K = input().split()
  p = []
  p = list(map(int, input().split()))
  p.sort()
  s = 0
  for i in range(int(K)):
    s = s + p[i]

  print(s)

if __name__ == "__main__":
    main()

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

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

print(ans)

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

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

Solution (Python):

def main():
  n, k = map(int, input().split())

  print(sum(
    sorted(map(int, input().split()))[:k]
  ))


main()

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

N, K = map(int, input().split())
p = 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()
ans = sum(p[:k])

print(ans)

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

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


nums = sorted(nums)

s = 0
c= 0
for num in nums:
	s+= num
	c += 1
	if c >= K:
		break
print(s)

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())
prices = list(map(int, input().split()))
prices.sort()
total = 0
for price in prices[:K]:
    total += price
print(total)

Solution (Python):


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


sorted_p = list(sorted(p))
ans = sum(sorted_p[:K])


print(ans)

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

price_list.sort()
if K == 1:
    print(price_list[0])
else:
    print(sum(price_list[:K]))

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

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

Solution (Python):



import itertools

def main():
    n, k = input_list()
    p = input_list()

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

def count_tento(l, cur):
    count = 0
    for v in l:
        if v > cur:
            count += 1
    return count

def input_list():
    return list(map(int, input().split()))

def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a

if __name__ == '__main__':
    main()

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


if __name__ == '__main__':
    main()

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

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

Solution (Python):
def bubble_sort(input_list):
    total_number = len(input_list)
    flag = True
    finished = 0

    while flag:
        flag = False
        for i in range(total_number-1-finished):
            if input_list[i] > input_list[i+1]:
                input_list[i], input_list[i+1] = input_list[i+1], input_list[i]
                flag = True
        finished += 1
        
    return(input_list)

def main():
    n, k = map(int, input().split())
    p_ = list(map(int, input().split()))
    p = bubble_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 = list(map(int,input().split()))

P_list.sort()
result = 0

for i in range(K):
    result += P_list[i]

print(result)

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

n = int(s[0])
k = int(s[1])

s = input().split()

p = []

for i in s:
    p.append(int(i))

p.sort()
cost = 0

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

print(cost)

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

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

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

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

fruit.sort()

buylist = fruit[0:k]
print(sum(buylist))

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

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

Solution (Python):






n, k = map(int, input().split())
p = list(map(int, input().split()))
sort = sorted(p)
ans = 0

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

print(ans)

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

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

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

print(ans)

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

p = input().split()
p = [int(i) for i in p]
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 = sorted(p)
print(sum(p_sorted[:k]))

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

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

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

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

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

s_price = sorted(price)

ans = 0

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

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

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()
ans = 0
for n in range(K):
  ans += p[n]
print(ans)

Solution (Python):

 
import sys

def get_int(): return int(sys.stdin.readline().strip())
def get_ints(): return map(int, sys.stdin.readline().strip().split()) 
def get_list(): return list(map(int, sys.stdin.readline().strip().split())) 
def get_string(): return sys.stdin.readline().strip()
def out(data): return sys.stdout.write(str(data))
def out_list(arr): return sys.stdout.write(' '.join(str(e) for e in arr))

MAX = 10**9
MOD = 10**9 + 7

n, k = get_ints()
arr = get_list()
arr.sort()

out(sum(arr[:k]))

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

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

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

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

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

Solution (Python):
import numpy as np

n, k= map(int, input().split())
p = input().split()
npp=np.array(p, dtype=int)

new_npp = sorted(npp)

print (sum(new_npp[0: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 = [int(i) for i in input().split()]
L = [int(i) for i in input().split()]


L.sort()
print(sum(L[0: 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()))

sum = 0

list.sort(p)

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

print(sum)

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

Solution (Python):
import operator as op
import re
import sys
from bisect import bisect, bisect_left, insort, insort_left
from collections import Counter, defaultdict, deque
from copy import deepcopy
from decimal import Decimal
from functools import reduce
from itertools import (
    accumulate, combinations, combinations_with_replacement, groupby,
    permutations, product)
from math import (acos, asin, atan, ceil, cos, degrees, factorial, gcd, hypot,
                  log2, pi, radians, sin, sqrt, tan)
from operator import itemgetter, mul
from string import ascii_lowercase, ascii_uppercase, digits








def inp():
    return(int(input()))


def inlist():
    return(list(map(int, input().split())))


def instr():
    s = input()
    return(list(s[:len(s)]))


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


def def_value():
    return 0


n, k = invr()
a = inlist()
a = sorted(a)
res = sum(a[:k])
print(res)

Solution (Python):
import sys

stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()  

n,k = na()
p = na()

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

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


def main():
    [n, k] = [int(e) for e in si().split()]
    l = [int(e) for e in si().split()]
    l.sort()
    s = 0
    for i in range(k):
        s += l[i]

    print(s)


if __name__ == '__main__':
    main()

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

Z = sorted(X)

print(sum(Z[0:M]))

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

p.sort()

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

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


def log(*args):
    print(*args, file=sys.stderr)


def main():
    _, k = map(int, input().strip().split())
    ps = sorted(map(int, input().strip().split()))
    print(sum(ps[:k]))


if __name__ == '__main__':
    main()

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

Solution (Python):
n, k = [int(z1) for z1 in input().split()]
arr = [int(z2) for z2 in input().split()]
arr.sort()
print(sum(arr[: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 = 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()
print(sum(P[:k]))

Solution (Python):
N,K = list(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()
sum = 0

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

print(sum)

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

min_cost = 0

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

print(min_cost)

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

S=sorted(p)
sum=0

for i in range(K):
  sum+=S[i]
print(sum)

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

p.sort()

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

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

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

Solution (Python):
import numpy as np


(N, K) = map(int, input().split())
A = np.array(list(map(int, input().split())))


def solve(N,K,A):
    return np.sum(np.sort(A)[0:K])
    

print(solve(N,K,A))

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

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

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):
def main():
    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)
    
main()

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

    p.sort()

    res=0
    for i in range(K):
        res+=p[i]
    print(res)
if __name__=="__main__":
    main()

Solution (Python):
n,k = map(int,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=sorted(map(int,input().split()))
r=0
for i in range(K):
  r+=P[i]
print(r)

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

plist.sort()

print(sum(plist[:K]))

Solution (Python):
import numpy as np
N,K = map(int, input().split())
Ps = np.array(list(map(int, input().split())))

Ps = np.sort(Ps)
res = Ps[:K].sum()
print(res)

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

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

def main():
    sum = 0
    for i in range(0, k):
        sum += p_s[i]
    print(sum)
    return

main()

Solution (Python):
def main():
    a, b = map(int, input().split())
    array = list(map(int, input().split()))

    new_array = sorted(array)
    sum  = 0
    for i in range(b):
        sum += new_array[i]

    print(sum)


if __name__ == "__main__":
    main()

Solution (Python):
N_syu, K_ko = map(int, input().split())
prices = list(map(int, input().split()))

prices.sort()

ans = sum(prices[:K_ko])
print(ans)

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

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

sum = 0
l.sort()
for i in range(m):
  sum += l[i]

print(sum)

Solution (Python):
import sys
import numpy as np
import math
from collections import deque 
from functools import reduce

n, k = map(int, input().split())
p = [list(map(int, input().split()))]
p_n = np.array(p)
p_n.sort()
p_n = p_n.reshape(-1)
print(sum(p_n[:k]))

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

pp = sorted(map(int, input().split()))

print(sum(pp[:k]))

Solution (Python):

import sys
input = sys.stdin.readline
N,K = (int(i) for i in input().split())
p = list(map(int, input().split()))
p.sort()
ans =p[:K]
print(sum(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 = sum + p[i]
print(sum)

Solution (Python):
n,k=map(int,input().split())
p=list(map(int,input().split()))
count=0
while k>0:
    count+=min(p)
    p.remove(min(p))
    k-=1
print(count)

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

print(sum(P))

Solution (Python):
n , k = map(int, input("").split())
p_i = list(map(int, input("").split()))
new_p_i = sorted(p_i)
price = 0
for i in range(k):
    price += new_p_i[i]

print(price)

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

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

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

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

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

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

l=sorted(p)
s=0
for m in range(k):
    s+=l[m]

print(s)

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

p_list = sorted(p_list)

print(sum(p_list[:K]))

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

def intlist(x):
    y = []
    for i in range(len(x)):
        y.append(int(x[i]))
    return y

p = intlist(input().split())

p.sort()

total = 0
for i in range(K):
    total = total + p[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(0,k):
    ans=ans+p[i]
print(ans)

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

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

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

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

plist.sort(reverse=False)

print(sum(plist[:k]))

Solution (Python):

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

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

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

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=[int(x) for x in input().split()]
p.sort()
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()
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 = map(int,input().split())
input_list = sorted(list(map(int,input().split())))
print(sum(input_list[:k]))