#include <bits/stdc++.h>
using namespace std;
const int N = 101;
int n, d, m;
int a[N];
int main() {
  cin >> n >> d;
  for (int(i) = (0); (i) < (n); i++) cin >> a[i];
  cin >> m;
  sort(a, a + N);
  int ans = 0;
  int count = m;
  for (int(i) = (0); (i) < (N); i++) {
    if (a[i] != 0 && m > 0) {
      ans += a[i];
      m -= 1;
    }
  }
  cout << ans - m * d << endl;
}
