#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, x;
  cin >> n >> x;
  long long sum = 0;
  int c[100000];
  for (int i = 0; i < n; i++) {
    cin >> c[i];
  }
  sort(c, c + n);
  for (int i = 0; i < n; i++) {
    sum += ((long long)c[i] * x);
    x = max(x - 1, 1);
  }
  cout << sum;
}
