#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, d, sm = 0;
  cin >> n >> d;
  int ar[n + 1];
  for (int i = 0; i < n; i++) {
    cin >> ar[i];
  }
  sort(ar, ar + n);
  int m;
  cin >> m;
  int x = m;
  for (int i = 0; i < min(x, n); i++) {
    sm += ar[i];
    m--;
  }
  cout << sm - m * d << endl;
  return 0;
}
