#include <bits/stdc++.h>
using namespace std;
template <class _Tp>
void ckmax(_Tp &a, _Tp b) {
  if (a < b) a = b;
}
template <class _Tp>
void ckmin(_Tp &a, _Tp b) {
  if (a > b) a = b;
}
template <class _Tp>
_Tp gcd(_Tp a, _Tp b) {
  return (b == 0) ? (a) : (gcd(b, a % b));
}
int read() {
  char ch = getchar();
  bool f = 1;
  int x = 0;
  while ((ch < '0' || ch > '9') && ch != '-') ch = getchar();
  if (ch == '-') f = 0, ch = getchar();
  while (ch >= '0' && ch <= '9') {
    x = x * 10 + (ch & 15);
    ch = getchar();
  }
  return f ? x : -x;
}
const int inf = 1000000000;
const long long Inf = 1000000000000000000ll;
int n, k;
long long b, c, ans;
long long calc(long long x, long long y) {
  long long d = y - x;
  return (d / 5ll) * b + (d % 5ll) * c;
}
vector<long long> v[5];
long long a[200050];
void solve(int d) {
  priority_queue<long long> q;
  int j = 1;
  long long now = 0, lst = 0;
  for (int i = 0; i < v[d].size(); ++i) {
    while (j <= n && a[j] <= v[d][i]) {
      long long t = calc(a[j], v[d][i]);
      now += t;
      q.push(t - lst);
      if (q.size() > k) {
        now -= (q.top() + lst);
        q.pop();
      }
      ++j;
    }
    if (q.size() >= k) ans = min(ans, now);
    if (i + 1 < v[d].size()) {
      long long t = ((v[d][i + 1] - v[d][i]) / 5) * b;
      lst += t;
      now += t * q.size();
    }
  }
}
int main() {
  n = read();
  k = read();
  b = read();
  c = read();
  if (c * 5 < b) b = c * 5;
  for (int i = 1; i <= n; ++i) {
    a[i] = read() + inf;
    for (int j = 0; j < 5; ++j) v[(a[i] + j) % 5].push_back(a[i] + j);
  }
  sort(a + 1, a + n + 1);
  ans = Inf;
  for (int i = 0; i < 5; ++i) {
    sort(v[i].begin(), v[i].end());
    solve(i);
  }
  printf("%lld\n", ans);
  return 0;
}
