#include <bits/stdc++.h>
using namespace std;
int main() {
  int n = 0, d = 0, k = 0;
  long long sum = 0;
  cin >> n >> d;
  int *m = new int[n];
  for (int i = 0; i < n; i++) {
    cin >> m[i];
  }
  sort(m, m + n);
  cin >> k;
  for (int i = 0; i < n; i++) {
    if (k > 0) {
      sum += m[i];
      k--;
    } else {
      break;
    }
  }
  sum -= k * d;
  cout << sum;
}
