#include <bits/stdc++.h>
using namespace std;
int arr[1000];
int main() {
  int n, d, m, mil = 1;
  cin >> n >> d;
  int sum = 0;
  for (int i = 0; i < n; i++) {
    cin >> arr[i];
  }
  cin >> m;
  sort(arr, arr + n);
  for (int i = 0; i < n && i < m; i++) {
    sum += arr[i];
  }
  if (m > n)
    cout << sum - (m - n) * d << endl;
  else
    cout << sum << endl;
  return 0;
}
