#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, d, m, j, s;
  s = 0;
  scanf("%d%d", &n, &d);
  int a[n];
  for (int i = 0; i < n; i++) {
    scanf("%d", &a[i]);
  }
  scanf("%d", &m);
  sort(a, a + n);
  if (m <= n) {
    j = 0;
    while (j < m) {
      s = s + a[j];
      ++j;
    }
  } else if (m > n) {
    j = 0;
    while (j < n) {
      s = s + a[j];
      ++j;
    }
    s = s - (d * (m - j));
  }
  cout << s << "\n";
  return 0;
}
