#include <bits/stdc++.h>
using namespace std;
typedef pair<long long, long long> ll;
typedef vector<long long> vl;
typedef vector<ll> vll;
typedef vector<vl> vvl;
template <typename T>
ostream &operator<<(ostream &o, vector<T> v) {
  if (v.size() > 0) o << v[0];
  for (unsigned i = 1; i < v.size(); i++) o << " " << v[i];
  return o << " ";
}
template <typename U, typename V>
ostream &operator<<(ostream &o, pair<U, V> p) {
  return o << "(" << p.first << ", " << p.second << ") ";
}
template <typename T>
istream &operator>>(istream &in, vector<T> &v) {
  for (unsigned i = 0; i < v.size(); i++) in >> v[i];
  return in;
}
template <typename T>
istream &operator>>(istream &in, pair<T, T> &p) {
  in >> p.first;
  in >> p.second;
  return in;
}
template <typename T>
ostream &operator<<(ostream &o, set<T> v) {
  for (auto &it : v) o << it << " ";
  return o << "\n";
}
template <typename T, typename U>
ostream &operator<<(ostream &o, map<T, U> v) {
  for (auto &it : v) o << it << " ";
  return o << "\n";
}
struct custom_hash {
  static uint64_t splitmix64(uint64_t x) {
    x += 0x9e3779b97f4a7c15;
    x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
    x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
    return x ^ (x >> 31);
  }
  size_t operator()(uint64_t x) const {
    static const uint64_t FIXED_RANDOM =
        chrono::steady_clock::now().time_since_epoch().count();
    return splitmix64(x + FIXED_RANDOM);
  }
};
int main(int argc, char *argv[]) {
  long long n, d;
  cin >> n >> d;
  vl a(n);
  cin >> a;
  long long m;
  cin >> m;
  sort((a).begin(), (a).end());
  if (m <= n) {
    long long res = 0;
    for (long long i = (0); i < (long long)m; i++) res += a[i];
    cout << res;
  } else {
    long long sum = accumulate((a).begin(), (a).end(), 0LL);
    cout << sum - (m - n) * d;
  }
  return 0;
}
