#include<bits/stdc++.h>
using namespace std;
const int N = 1000;
int dp[N][N];
int n, c[N], b, m;
int main(){
scanf("%d%d%d", &n, &b, &m);
dp[0][b] = 1;
for(int i = 1; i <= n; i++) scanf("%d", &c[i]);
for(int i = 1; i <= n; i++){
for(int j = 0; j <= m; j++){
if(j - c[i] >= 0) dp[i][j] |= dp[i - 1][j - c[i]];
if(j + c[i] <= m) dp[i][j] |= dp[i - 1][j + c[i]];
}
}
for(int i = m; i >= 0; i--){
if(dp[n][i]){
printf("%d\n", i);
return 0;
}
}
printf("-1\n");
return 0;
}