import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.Arrays; public class Main { public static void main(String[] args) throws Exception { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String[] sa = br.readLine().split(" "); int n = Integer.parseInt(sa[0]); int m = Integer.parseInt(sa[1]); int p = Integer.parseInt(sa[2]); sa = br.readLine().split(" "); int[] a = new int[n]; for (int i = 0; i < n; i++) { a[i] = Integer.parseInt(sa[i]); } br.close(); Arrays.sort(a); int max = 0; for (int i = n - 1; i >= 0; i--) { if (a[i] % p != 0) { max = a[i]; break; } } if (max <= 1) { System.out.println(-1); } else { long x = 1; int ans = 0; while (x <= m) { ans++; x *= max; } System.out.println(ans); } } }