#include <bits/stdc++.h>
using namespace std;
int min(int a, int b) {
  if (a < b)
    return a;
  else
    return b;
}
int getProfit(vector<int>& arr, int n, int d, int m) {
  int result = 0;
  if (m > n) {
    for (int i = 0; i < n; i++) {
      result += arr[i];
    }
    result -= (m - n) * d;
  } else {
    sort(arr.begin(), arr.end());
    for (int i = 0; i < m; i++) {
      result += arr[i];
    }
  }
  return result;
}
void execute() {
  int n;
  int d;
  int m;
  vector<int> arr;
  cin >> n;
  cin >> d;
  int temp;
  for (int i = 0; i < n; ++i) {
    cin >> temp;
    arr.push_back(temp);
  }
  cin >> m;
  cout << getProfit(arr, n, d, m);
}
int main() {
  execute();
  return 0;
}
