n, m, p = map(int, input().split()) A = list(map(int, input().split())) from collections import defaultdict C = defaultdict(lambda: 0) D = [] for a in A: b = a cost = 1 while a%p == 0: cost += 1 a //= p C[cost] = max(C[cost], a) M = max(A) dp = [0]*101 dp[0] = 1 for c, a in C.items(): for i in range(101): if i+c <= 100: dp[i+c] = max(dp[i+c], dp[i]*a) ans = 10**18 for i, x in enumerate(dp): if x*M> m: ans = min(ans, i+1) if ans != 10**18: print(ans) else: print(-1)