#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
const int maxn = 1e5 + 5;
const ll inf = 1e18;
int n, cnt1;
ll S, M, ans, a[maxn];
vector<ll> d;
vector<int> pos;
void dfs(ll x, int lim, int now, int res, ll sum) {
sum += x;
if(S - sum >= 0) {
int to = now, p = lower_bound(d.begin(), d.end(), x) - d.begin();
ll nres = res;
if(!d.empty() && to <= n && a[to] < d[p]) {
nres += pos[p] - to;
to = pos[p];
}
// a[to] >= x
if(to <= n && a[to] == x) {
to++;
}
else {
nres++;
}
nres += n - to + 1;
nres += abs(S - sum - cnt1);
ans = min(ans, nres);
}
sum -= x;
ll t = sqrt(x);
for(int i = lim; i < (int)d.size() && d[i] <= t; i++) {
if(x % d[i] == 0) {
int to = now, nres = res;
if(to <= n && a[to] < d[i]) {
nres += pos[i] - to;
to = pos[i];
}
// a[to] >= d[i]
if(to <= n && a[to] == d[i]) {
to++;
}
else {
nres++;
}
dfs(x / d[i], i, to, nres, sum + d[i]);
}
}
}
int main() {
#ifdef yczDEBUG
freopen("1.in", "r", stdin);
freopen("1.out", "w", stdout);
#endif
ios::sync_with_stdio(0);
cin.tie(0);
int N;
cin >> N >> S >> M;
n = cnt1 = 0;
int t = sqrt(M);
for(int i = 2; i <= t; i++) {
if(M % i == 0) {
d.push_back(i);
if(M / i != i) {
d.push_back(M / i);
}
}
}
if(M != 1) {
d.push_back(M);
}
sort(d.begin(), d.end());
for(int i = 1; i <= N; i++) {
ll x;
cin >> x;
if(x == 1) {
cnt1++;
}
else {
a[++n] = x;
}
}
sort(a + 1, a + 1 + n);
for(int i = 0; i < (int)d.size(); i++) {
pos.push_back(lower_bound(a + 1, a + 1 + n, d[i]) - a);
}
ans = inf;
dfs(M, 0, 1, 0, 0);
if(ans == inf) {
cout << "-1\n";
}
else {
cout << ans << '\n';
}
return 0;
}