#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int n, tym;
  scanf("%I64d %I64d", &n, &tym);
  long long int book[n];
  for (int i = 0; i < n; i++) {
    scanf("%I64d", &book[i]);
  }
  sort(book, book + n);
  long long int ans = 0;
  for (int i = 0; i < n; i++) {
    ans += book[i] * tym;
    if (tym > 1) tym--;
  }
  printf("%I64d\n", ans);
  return 0;
}
