#include <stdio.h>
int main()
{
int m, arr[110],k, i, s=0, j, n;
scanf("%d", &n);
scanf("%d", &m);
for(i=1; i<=n; i++)
scanf("%d", &arr[i]);
for(j = 2; j <= n; j++)
for(i = 2; i <= n; i++)
{
if(arr[i]<arr[i-1])
{
k = arr[i-1];
arr[i-1] = arr[i];
arr[i] = k;
}
}
for(i=1;i<=n;i++)
printf("%d", arr[i]);
for(i=1;i<=m;i++)
{
if(arr[i] < 0)
s += arr[i];
}
printf("%d\n", -s);
return 0;
}