#include <bits/stdc++.h>
using namespace std;
int main() {
  int N, K;
  cin >> N >> K;
  vector<int> price;
  int p;
  int maxSum = 0;
  for (int i = 0; i < N; i++) {
    cin >> p;
    maxSum += p;
    price.push_back(p);
  }
  sort(price.begin(), price.end());
  int sum = 0;
  int res = 0;
  if (K > N) {
    res = maxSum + (K - N) * price[0];
    cout << res << endl;
  } else {
    for (int i = 0; i < K; i++) {
      res += price[i];
      price.push_back(p);
    }
    cout << res << endl;
  }
}
