#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, t;
  cin >> n >> t;
  long long a[n];
  for (long long i = 0; i < n; i++) cin >> a[i];
  sort(a, a + n);
  long long ans = 0;
  for (long long i = 0; i < n; i++) {
    ans += a[i] * t;
    if (t >= 2)
      t--;
    else
      t = 1;
  }
  cout << ans << endl;
}
