#include using namespace std; using i64 = int64_t; int main() { i64 N, M, K; cin >> N >> M >> K; vector A(N); for (i64 i = 0; i < N; i++) { cin >> A[i]; } queue> que; que.push({0, 0}); i64 ans = 0; map m; while (que.size()) { pair p = que.front(); que.pop(); if (m[p.second] != p.first) { continue; } ans = max(ans, p.second); for (i64 i : A) { if (p.second + i <= M && m[p.second + i] == 0 & m[p.second + i] < p.first + 1) { que.push({p.first + 1, p.second + i}); } } } cout << ans << endl; return 0; }