#include <bits/stdc++.h>
using namespace std;
int main() {
  vector<int> vec;
  int n, d, m, ans = 0;
  cin >> n >> d;
  vec.resize(n);
  for (int i = 0; i < n; cin >> vec[i++])
    ;
  cin >> m;
  sort(vec.begin(), vec.end());
  if (m > n) ans -= (m - n) * d, m = n;
  for (int i = 0; i < m; ans += vec[i++])
    ;
  cout << ans << endl;
  return 0;
}
