#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, d, m, profit = 0;
  cin >> n >> d;
  vector<int> a(n, 0);
  for (int i = 0; i < n; i++) cin >> a[i];
  cin >> m;
  sort(a.begin(), a.end());
  while (m) {
    if (a.size()) {
      profit += a[0];
      a.erase(a.begin());
    } else {
      profit -= d;
    }
    --m;
  }
  cout << profit;
  return 0;
}
