#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  int d;
  cin >> n >> d;
  int a[n];
  int profit = 0;
  for (int c = 0; c < n; c++) {
    cin >> a[c];
  }
  sort(a, a + n);
  int m;
  cin >> m;
  if (m <= n) {
    for (int c = 0; c < m; c++) {
      profit += a[c];
    }
  } else {
    for (int c = 0; c < n; c++) {
      profit += a[c];
    }
  }
  if (m - n > 0) {
    cout << profit - d * (m - n) << endl;
  } else {
    cout << profit << endl;
  }
}
