#include <cstdio>
#include <cstring>
#include <iostream>
using namespace std;
const int N = 1010;
int n, s, e;
int f[N];
int main()
{
int v;
cin >> n >> s >> e;
f[s] = 1;
for (int i = 1; i <= n; i ++ )
{
cin >> v;
for (int j = e; j >= 0; j -- )
{
if (j - v >= 0) f[j] |= f[j - v];
if (j + v <= e) f[j] |= f[j + v];
}
}
for (int j = e; j >= 0; j -- )
if (f[j])
{
cout << j << endl;
return 0;
}
cout << -1 << endl;
return 0;
}