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