n, m, a, b = map(int, input().split()) C = list(map(int, input().split())) C.sort() div = [] for i in range(1, int(n ** 0.5 + 1)): if n % i == 0: div.append(i) if i * i != n: div.append(n // i) div.sort() l = len(div) inf = 1 << 60 mi = [inf] * l for i in range(l): d = div[i] for c in C: if c % d == 0: mi[i] = c break dp = [inf] * l dp[0] = -b for i, d in enumerate(div): x = dp[i] + b for j in range(i + 1, l): if div[j] % d != 0: continue if div[j] >= mi[i]: break dp[j] = min(dp[j], x + a * (div[j] // d - 1)) ans = dp[-1] if ans == inf: ans = -1 print(ans)