#include <bits/stdc++.h>
using namespace std;
const int MAXN = 100000;
int n, x;
int c[MAXN + 5];
long long res;
int main() {
  scanf("%d %d", &n, &x);
  for (int i = 0; i < n; ++i) {
    scanf("%d", &c[i]);
  }
  sort(c, c + n);
  for (int i = 0; i < n; ++i) {
    res += (long long)c[i] * (long long)x;
    x = max(1, x - 1);
  }
  printf("%I64d\n", res);
  return 0;
}
