#include <bits/stdc++.h>
using namespace std;
const long MaxArray = 121073;
long n;
long long ans, m;
long long a[MaxArray];
int main() {
  scanf("%d %d", &n, &m);
  for (long i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
  }
  sort(a + 1, a + n + 1);
  for (long long i = 1; i <= n; i++) {
    ans += a[i] * m;
    if (m > 1) {
      m--;
    }
  }
  cout << ans;
  return 0;
}
