#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
using namespace std;
void solve(int cs) {
int n, k, x;
cin >> n >> k >> x;
vector<int> a(n);
for (int i = 0; i < n; i++) {
cin >> a[i];
}
int res = 0;
for (int g = x + 1; g <= 100; g++) {
auto b = a;
for (int j = 0; j < n; j++) {
b[j] = (g - (b[j] % g)) % g;
}
queue<int> Q;
int sum = 0;
for (int i = 0; i < n; i++) {
sum += b[i];
Q.push(b[i]);
while (sum > k) {
sum -= Q.front();
Q.pop();
}
if (sum <= k) {
res = max(res, (int)Q.size());
}
}
}
cout << res << "\n";
}
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int tc = 1;
// cin >> tc;
for (int cs = 1; cs <= tc; cs++) {
solve(cs);
}
return 0;
}