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

print(sum(p[:K]))

Solution (Python):





import sys
import heapq

def main():
    n, k = map(int, input().split())
    nums = list(map(int, sys.stdin.readline().split()))
    nums.sort()
    print(sum(nums[:k]))
    return

if __name__ == "__main__":
    main()

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

Solution (Python):
import sys
import math
import collections
import decimal
import itertools
from collections import deque
from functools import reduce
import heapq

n, k = map(int, sys.stdin.readline().split())

p = list(map(int, sys.stdin.readline().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()]
arr = [int(x) for x in input().split()]

arr.sort()

print(sum(arr[:k]))

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

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

print(sum(A[:K]))

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

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

Solution (Python):


import sys
import math
import itertools
import collections

def solve(N,K,P):
    P.sort()
    ans = 0
    for i in range(K):
        ans += P.pop(0)
    return ans
def main():
    N,K = map(int,input().split())
    P = list(map(int,input().split()))
    
    print(solve(N,K,P))

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):
from collections import deque,defaultdict as dd 
from bisect import bisect,bisect_left,bisect_right,insort,insort_left,insort_right
from itertools import permutations
from datetime import datetime
from math import ceil,sqrt,log,gcd
def ii():return int(input())
def si():return input()
def mi():return map(int,input().split())
def li():return list(mi())
abc='abcdefghijklmnopqrstuvwxyz'
abd={'a': 0, 'b': 1, 'c': 2, 'd': 3, 'e': 4, 'f': 5, 'g': 6, 'h': 7, 'i': 8, 'j': 9, 'k': 10, 'l': 11, 'm': 12, 'n': 13, 'o': 14, 'p': 15, 'q': 16, 'r': 17, 's': 18, 't': 19, 'u': 20, 'v': 21, 'w': 22, 'x': 23, 'y': 24, 'z': 25}
mod=1000000007

inf = float("inf")
vow=['a','e','i','o','u']
dx,dy=[-1,1,0,0],[0,0,1,-1]

def bo(i):
    return ord(i)-ord('a')





    





n,k=mi()
a=li()
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):
N, K = [int(x) for x in input().split(' ')]
p = [int(x) for x in 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):
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):
import sys, re
from math import ceil, floor, sqrt, pi, factorial, gcd
from copy import deepcopy
from collections import Counter, deque
from heapq import heapify, heappop, heappush
from itertools import accumulate, product, combinations, combinations_with_replacement
from bisect import bisect, bisect_left
from functools import reduce
from decimal import Decimal, getcontext

def i_input(): return int(input())
def i_map(): return map(int, input().split())
def i_list(): return list(i_map())
def i_row(N): return [i_input() for _ in range(N)]
def i_row_list(N): return [i_list() for _ in range(N)]
def s_input(): return input()
def s_map(): return input().split()
def s_list(): return list(s_map())
def s_row(N): return [s_input for _ in range(N)]
def s_row_list(N): return [s_list() for _ in range(N)]
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
def lcm(a, b): return a * b // gcd(a, b)
sys.setrecursionlimit(10 ** 6)
INF = float('inf')
MOD = 10 ** 9 + 7
num_list = []
str_list = []

def main():
    n, k = i_map()
    num_list = i_list()

    num_list.sort()

    count = 0

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

    print(count)

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):
import io,sys
sys.setrecursionlimit(10**6)

def main():
    n,k = map(int,sys.stdin.readline().rstrip().split())
    P = list(map(int,sys.stdin.readline().rstrip().split()))
    P.sort()
    print(sum(P[:k]))
main()

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

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

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

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

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

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

print(sum(price[: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())
ps = list(map(int, input().split()))

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

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

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

p.sort()

print(sum(p[:k]))

Solution (Python):
import sys
read = sys.stdin.read
readline = sys.stdin.buffer.readline
INF = float('inf')


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

if __name__ == '__main__':
    main()

Solution (Python):

import sys,io,os,time
from collections import defaultdict
from collections import OrderedDict
from collections import deque
from itertools import combinations
from itertools import permutations
import bisect,math,heapq
alphabet = "abcdefghijklmnopqrstuvwxyz"

input = sys.stdin.readline




n , k = map(int , input().split())
arr = list(map(int , input().split()))
arr.sort()
print(sum(arr[: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())
li = list(map(int, input().split()))

li.sort()

ans = 0

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

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

Solution (Python):
n_fruit, n_mustbuy = map(int,input().split())
price_ls = list(map(int, input().split()))
price_ls.sort()

print(sum(price_ls[:n_mustbuy]))

Solution (Python):
import bisect, collections, copy, heapq, itertools, math, numpy, string
import sys
from bisect import bisect_left, bisect_right, insort
from collections import deque
def S(): return sys.stdin.readline().rstrip()
def I(): return int(sys.stdin.readline().rstrip())
def MI(): return map(int, sys.stdin.readline().rstrip().split())
def MS(): return map(str, sys.stdin.readline().rstrip().split())
def LI(): return list(map(int, sys.stdin.readline().rstrip().split()))
def LS(): return list(sys.stdin.readline().rstrip().split())



n,k = MI()
p =LI()
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[:k]))

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

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

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

ans = 0

for i in range(M):
    ans += A[i]

print(ans)

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

Solution (Python):

def s0():return input()
def s1():return input().split()
def s2(n):return [input() for x in range(n)]
def s3(n):return [input().split() for _ in range(n)]
def s4(n):return [[x for x in s] for s in s2(n)]
def n0():return int(input())
def n1():return [int(x) for x in input().split()]
def n2(n):return [int(input()) for _ in range(n)]
def n3(n):return [[int(x) for x in input().split()] for _ in range(n)]
def t3(n):return [tuple(int(x) for x in input().split()) for _ in range(n)]
def p0(b,yes="Yes",no="No"): print(yes if b else no)








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

Solution (Python):


import sys
import numpy as np
int1 = lambda x: int(x) - 1
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(500000)

N, K, *P = map(int, read().split())

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

Solution (Python):
import sys
input=lambda: sys.stdin.readline().rstrip()
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())
a = list(map(int, input().split()))
a.sort()
print(sum(a[:k]))

Solution (Python):
import sys
from collections import defaultdict
readline = sys.stdin.buffer.readline
sys.setrecursionlimit(10**8)


def geta(fn=lambda s: s.decode()):
    return map(fn, readline().split())


def gete(fn=lambda s: s.decode()):
    return fn(readline().rstrip())


def main():
    n, k = geta(int)
    p = list(geta(int))

    p.sort()

    print(sum(p[:k]))


if __name__ == "__main__":
    main()

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

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

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


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

print(sum(p[:K]))

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

Solution (Python):
(N, K) = [int(n) for n in input().split()]
p = sorted([int(n) for n in 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 = map(int, input().split())
p = list(map(int, input().split()))

p.sort()

print(sum(p[:k]))

Solution (Python):
from collections import Counter
import sys

sys.setrecursionlimit(10 ** 6)

mod = 1000000007
inf = int(1e18)

dx = [0, 1, 0, -1]
dy = [1, 0, -1, 0]


def inverse(a):
    return pow(a, mod - 2, mod)


def usearch(x, a):
    lft = 0
    rgt = len(a) + 1
    while rgt - lft > 1:
        mid = (rgt + lft) // 2
        if a[mid] <= x:
            lft = mid
        else:
            rgt = mid
    return lft



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

main()

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

print(sum(array[:k]))

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

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

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

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

t.sort()

print(sum(t[:y]))

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

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

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

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

p.sort()

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

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

Solution (Python):
N,K=map(int,input().split())
p=map(int,input().split())
P=[int(a) for a in p]
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[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):
N, K = map(int, input().split())
P = list(map(int, input().split()))

P.sort()

print(sum(P[:K]))

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

print(ans)

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

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

'''

'''

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

Solution (Python):
from sys import stdin, setrecursionlimit


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


if __name__ == "__main__":
    setrecursionlimit(10000)
    main()

Solution (Python):


N, K = input().split(' ')
K = int(K)
A = input().split(' ')
A = sorted(list(map(int, A)))

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):
N, K = map(int, input().split())
p_int_list = list(map(int, input().split()))
p_int_list_sorted = sorted(p_int_list)

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

print(sum(P[:K]))

Solution (Python):
import sys


def _ia(): return map(int, sys.stdin.readline().strip().split())


def main():
    n, k = _ia()
    p = sorted(_ia())
    return sum(p[:k])


if __name__ == "__main__":
    print(main())

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

Solution (Python):

import sys
import math
from bisect import bisect_left
from bisect import bisect_right
from collections import defaultdict
from heapq import heappop, heappush
import itertools
from decimal import *

input = sys.stdin.readline

def inputInt(): return int(input())
def inputMap(): return map(int, input().split())
def inputList(): return list(map(int, input().split()))
def inputStr(): return input()[:-1]

inf = float('inf')
mod = 1000000007




def main():
	N,K = inputMap()
	p = inputList()

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

	print(ans)





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

Solution (Python):

import collections
import itertools as it
import math

 


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




l = sorted(l)
print(sum(l[:k]))

Solution (Python):
import sys, collections, bisect, itertools, heapq, math, copy
input = lambda: sys.stdin.readline().rstrip() 
sys.setrecursionlimit(10**7)
INF = float('inf')
def I(): return int(input())
def F(): return float(input())
def SS(): return input()
def LI(): return [int(x) for x in input().split()]
def LI_(): return [int(x)-1 for x in input().split()]
def LF(): return [float(x) for x in input().split()]
def LSS(): return input().split()

def resolve():
    N, K = LI()
    p = LI()

    p.sort()

    print(sum(p[:K]))

if __name__ == '__main__':
    resolve()

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

print(sum(sorted(L)[:k]))

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

Solution (Python):



import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby, product
from bisect import bisect_left,bisect_right
from heapq import heapify, heappop, heappush
from math import floor, ceil,pi,factorial
from operator import itemgetter
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def LI2(): return [int(input()) for i in range(n)]
def MXI(): return [[LI()]for i in range(n)]
def SI(): return input().rstrip()
def printns(x): print('\n'.join(x))
def printni(x): print('\n'.join(list(map(str,x))))
inf = 10**17
mod = 10**9 + 7

n,k=MI()
lis=LI()
lis.sort()
print(sum(lis[0:k]))

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)

if __name__ == "__main__":
    main()

Solution (Python):

import numpy as np
from collections import deque
from collections import defaultdict
import heapq
import collections
import itertools
import bisect


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


def z():
    return int(input())


def S():
    return input()


def C(line):
    return [input() for _ in range(line)]


def get_ashi(x, y):
    return 2*x + 4*y


N, K = zz()
p = zz()
p = sorted(p)
print(sum(p[:K]))

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

p_list.sort()

print(sum(p_list[:K]))

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

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


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


if __name__ == "__main__":
    main()

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

p_list.sort(reverse=False)

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

Solution (Python):


n, k = map(int, input().split())
p_l = [int(x) for x in input().split()]

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

PList.sort()
result = 0

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

print(result)

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

print(sum(p[:k]))

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

Solution (Python):
def iput(): return int(input())
def mput(): return map(int, input().split())
def lput(): return list(map(int, input().split()))

def solve():
    n, k = mput()
    p = lput()
    p.sort()
    ans = sum(p[:k])
    print(ans)
    return 0

if __name__ == "__main__":
    solve()

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

Solution (Python):
import sys,queue,math,copy,itertools,bisect,collections,heapq

def main():
    sys.setrecursionlimit(10**7)
    INF = 10**18
    MOD = 10**9 + 7
    LI = lambda : [int(x) for x in sys.stdin.readline().split()]
    _LI = lambda : [-int(x) for x in sys.stdin.readline().split()]
    NI = lambda : int(sys.stdin.readline())
    SI = lambda : sys.stdin.readline().rstrip()
    DD = ((1,0),(0,1),(-1,0),(0,-1))

    N,K = LI()
    p = LI()

    p.sort()
    print(sum(p[:K]))
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=[int(_) for _ in input().split()]
p=[int(_) for _ in input().split()]

p.sort()

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

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

Solution (Python):


import sys
input=sys.stdin.readline

def main():
    N,K=map(int,input().split())
    ps=list(map(int,input().split()))
    ps.sort()
    print(sum(ps[:K]))
    
    
    
if __name__=="__main__":
    main()

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

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

Solution (Python):
from heapq import heappush, heappop, heapify
from collections import deque, defaultdict, Counter
import itertools
from itertools import permutations, combinations, accumulate, product, combinations_with_replacement
import sys
import bisect
import string
import math
import time


def I(): return int(input())
def S(): return input()
def MI(): return map(int, input().split())
def MS(): return map(str, input().split())
def LI(): return [int(i) for i in input().split()]
def LI_(): return [int(i)-1 for i in input().split()]
def StoI(): return [ord(i)-97 for i in input()]
def ItoS(nn): return chr(nn+97)
def input(): return sys.stdin.readline().rstrip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]
def print_matrix(mat):
    for i in range(len(mat)):
        print(*['IINF' if v == IINF else "{:0=4}".format(v) for v in mat[i]])


yn = {False: 'No', True: 'Yes'}
YN = {False: 'NO', True: 'YES'}
MOD = 10**9+7
inf = float('inf')
IINF = 10**19
l_alp = string.ascii_lowercase
u_alp = string.ascii_uppercase
ts = time.time()
sys.setrecursionlimit(10**6)
nums = ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10']
show_flg = False



def main():
    N, K = MI()
    p = LI()
    ans = 0

    p.sort()

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

    print(ans)

if __name__ == '__main__':
    main()

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

print(sum(p[:K]))

Solution (Python):
import sys
import math
import itertools
import bisect
from copy import copy
from collections import deque,Counter
from decimal import Decimal
def s(): return input()
def i(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def L(): return list(input().split())
def l(): return list(map(int,input().split()))
def lcm(a,b): return a*b//math.gcd(a,b)
sys.setrecursionlimit(10 ** 9)
mod = 10**9+7

N,K = I()
p = l()
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[:K]))

Solution (Python):

from __future__ import division, print_function

import os
import sys
from io import BytesIO, IOBase

if sys.version_info[0] < 3:
    from __builtin__ import xrange as range
    from future_builtins import ascii, filter, hex, map, oct, zip


def main():
    n, k = map(int, input().split())
    p = sorted([int(pi) for pi in input().split()])

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


def print(*args, **kwargs):
    """Prints the values to a stream, or to sys.stdout by default."""
    sep, file = kwargs.pop("sep", " "), kwargs.pop("file", sys.stdout)
    at_start = True
    for x in args:
        if not at_start:
            file.write(sep)
        file.write(str(x))
        at_start = False
    file.write(kwargs.pop("end", "\n"))
    if kwargs.pop("flush", False):
        file.flush()


if sys.version_info[0] < 3:
    sys.stdin, sys.stdout = FastIO(sys.stdin), FastIO(sys.stdout)
else:
    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())
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  = list(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())))
p.sort()
ans = sum(p[:K])
print(ans)

Solution (Python):

import sys
import numpy as np

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

N, K = lr()
A = lr()
A.sort()
answer = sum(A[:K])
print(answer)

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

a.sort()

print(sum(a[:k]))

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

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

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

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

Solution (Python):
import sys

N, K = map(int, input().split())
P = list(map(int, sys.stdin.readline().rsplit()))
P.sort()

print(sum(P[:K]))

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