## https://yukicoder.me/problems/no/2039 import math MAX_INT = 10 ** 18 def main(): N, M, A, B = map(int, input().split()) C = list(map(int, input().split())) # 約数列挙 sqrt_n = int(math.sqrt(N)) divisors = [] for p in range(1, sqrt_n + 1): if N % p == 0: q = N // p divisors.append(p) if q != p: divisors.append(q) divisors.sort() # 約数群と通過しては行けない数字の和集合を求める target_set = set(C) for d in divisors: target_set.add(d) target_map = {t: True for t in target_set} for c in C: target_map[c] = False target_array = [(key, value) for key, value in target_map.items()] target_array.sort(key=lambda x : x[0]) a_dp = {1:0} b_dp = {} for d_index in range(len(divisors)): d = divisors[d_index] if d == 1: b_dp[d] = 0 elif d == N: break else: if d in a_dp and a_dp[d] < MAX_INT: b_dp[d] = B + a_dp[d] else: continue # 操作aを使ってどれだけ行けるか? for t, available in target_array: if t <= d: continue if t % d == 0: if not available: break x = t // d cost = b_dp[d] + (x - 1) * A if t not in a_dp: a_dp[t] = MAX_INT a_dp[t] = min(a_dp[t], cost) if N in a_dp and a_dp[N] < MAX_INT: print(a_dp[N]) else: print(-1) if __name__ == "__main__": main()