#include <bits/stdc++.h>
int Desc(const void* a, const void* b) {
  return *(const int*)a > *(const int*)b ? -1 : 1;
}
int IN(void) {
  int x = 0, f = 0, c = getchar();
  while (c < 48 || c > 57) {
    f ^= c == 45, c = getchar();
  }
  while (c > 47 && c < 58) {
    x = x * 10 + c - 48, c = getchar();
  }
  return f ? -x : x;
}
int main(void) {
  int N = IN(), K = IN(), P[1000] = {0}, i = 0, sum = 0;
  while (i < N) {
    P[i++] = IN();
  }
  qsort(P, (size_t)N, sizeof(int), Desc);
  while (i >= K) {
    sum += P[--i];
  }
  return printf("%d\n", sum), 0;
}
