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