#include <bits/stdc++.h>
using namespace std;
void fastIO() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.precision(20);
}
long long A[100006];
long long B[100006];
long long C[100006];
long long rev(long long a, long long b) { return a > b; }
int main() {
  fastIO();
  vector<long long> V;
  set<long long> S;
  set<long long>::iterator it;
  map<string, long long> M;
  map<string, long long>::iterator it1;
  long long a, b, c;
  long long n, m;
  long long cnt = 0, cntr = 0, sum = 0, ans = 1;
  long long p, q, r;
  long long v = 1;
  long long check = 0;
  long long x, y, z;
  long long Max = 0, Min = INT_MAX;
  string s, s1[100006], s2[100006], s3, s4;
  cin >> n >> m;
  for (int i = 0; i < n; i++) cin >> A[i];
  sort(A, A + n);
  for (int i = 0; i < n; i++) {
    sum += (A[i] * m--);
    if (m == 0) m = 1;
  }
  cout << sum << endl;
  return 0;
}
