def devisors(n): d = [] a = 1 while a * a < n: if n % a == 0: d.append(a) d.append(n // a) a += 1 if a * a == n: d.append(a) return d INF = 10 ** 18 n, m, a, b = map(int, input().split()) c = list(map(int, input().split())) c.sort() dv = devisors(n) dv.sort() k = len(dv) dp = [INF] * k dp[0] = 0 prv = [-1] * k for i in range(k): x = INF for j in range(m): if c[j] % dv[i] == 0: x = c[j] break for j in range(i + 1, k): if dv[j] % dv[i] > 0: continue if dv[j] >= x: break if dp[j] > dp[i] + a * (dv[j] // dv[i] - 1) + b: dp[j] = dp[i] + a * (dv[j] // dv[i] - 1) + b prv[j] = dv[i] if dp[-1] > 10 ** 10: print(-1) else: print(dp[-1] - b)