n, m, p = map(int, input().split()) a = list(map(int, input().split())) mx = max(a) t = (m + mx - 1) // mx if t == 1 or mx == 1: print(1) exit() q = [] for ai in a: cnt = 1 while ai % p == 0: cnt += 1 ai //= p if ai == 1: continue q.append((ai, cnt)) if not q: print(-1) exit() dp = [0] * 100000 dp[0] = 1 for i in range(100000): if dp[i] >= t: print(i + 1) break for x, c in q: dp[i + c] = max(dp[i + c], dp[i] * x)