#include <bits/stdc++.h>
using namespace std;
const long long M = 200005;
long long read() {
  long long num = 0, flag = 1;
  char c;
  while ((c = getchar()) < '0' || c > '9')
    if (c == '-') flag = -1;
  while (c >= '0' && c <= '9')
    num = (num << 3) + (num << 1) + (c ^ 48), c = getchar();
  return num * flag;
}
long long n, k, x, y, a[M], ans;
vector<long long> b[5];
long long cal(long long u, long long v) {
  long long d = v - u;
  return (d / 5) * x + (d % 5) * y;
}
void work(long long w) {
  priority_queue<long long> q;
  long long j = 1, s = 0, la = 0;
  for (long long i = 0; i < b[w].size(); i++) {
    while (j <= n && a[j] <= b[w][i]) {
      long long ct = cal(a[j], b[w][i]);
      s += ct;
      q.push(ct - la);
      if (q.size() > k) {
        s -= (q.top() + la);
        q.pop();
      }
      j++;
    }
    if (q.size() >= k) ans = min(ans, s);
    if (i + 1 < b[w].size()) {
      long long t = ((b[w][i + 1] - b[w][i]) / 5) * x;
      la += t;
      s += t * q.size();
    }
  }
}
signed main() {
  n = read();
  k = read();
  x = read();
  y = read();
  x = min(x, 5 * y);
  for (long long i = 1; i <= n; i++) {
    a[i] = read() + 1e9;
    for (long long j = 0; j < 5; j++) b[(a[i] + j) % 5].push_back(a[i] + j);
  }
  sort(a + 1, a + 1 + n);
  ans = 1e18;
  for (long long i = 0; i < 5; i++) {
    sort(b[i].begin(), b[i].end());
    work(i);
  }
  printf("%lld\n", ans);
}
