#include<stdio.h>
void main()
{
  int k,n,total_price=0;
  int price[1000];
  scanf("%d",&n);
  scanf("%d",&k);
  for(int i=0;i<n;i++)
  {
    scanf("%d",&price[i]);
  }
  for (int i = 0; i < n; ++i) 
        {
            for (int j = i + 1; j < n; ++j) 
            {
                if (price[i] > price[j]) 
                {
                    int a = price[i];
                    price[i] = price[j];
                    price[j] = a;
                }
            }
        }

        for(int i=0;i<k;i++)
        {
            total_price=total_price+price[i];
        }
        printf("total_price:%d",total_price);
}
