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