import heapq def main(): import sys N, M, A, B = map(int, sys.stdin.readline().split()) C = list(map(int, sys.stdin.readline().split())) forbidden = set(C) if N in forbidden: print(-1) return heap = [] heapq.heappush(heap, (0, 1)) visited = {} while heap: cost, y = heapq.heappop(heap) if y in visited: if visited[y] <= cost: continue visited[y] = cost if y == N: print(cost) return t_max = N // y if t_max < 2: continue forbidden_t = [] for c in C: if c % y == 0: t = c // y if t >= 2: forbidden_t.append(t) forbidden_t.sort() if forbidden_t: first_forbidden = forbidden_t[0] max_t = min(first_forbidden - 1, t_max) else: max_t = t_max ki_max = max_t - 1 if ki_max < 1: continue for ki in range(1, ki_max + 1): new_x = y * (ki + 1) if new_x > N: continue new_cost = cost + ki * A if new_x == N: print(new_cost) return else: new_y = new_x new_cost_b = new_cost + B if new_y not in visited or visited.get(new_y, float('inf')) > new_cost_b: heapq.heappush(heap, (new_cost_b, new_y)) print(-1) if __name__ == "__main__": main()