#include <bits/stdc++.h>  // clang-format off
using namespace std;
using i64 = int64_t;
using pii = pair<i64, i64>;
#define rep(i, n) for (i64 i = 0; i < i64(n); i++)
#define per(i, n) for (i64 i = n - 1; i >= 0; i--)
#define REP(i, a, b) for (i64 i = a; i < i64(b); i++)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define fi first
#define se second
#ifdef LOCAL
#define dbg(...) cerr<<__LINE__<<" ["<<#__VA_ARGS__<<"]:",debug(__VA_ARGS__)
#else
#define dbg(...)
#endif
template <typename T1, typename T2> ostream &operator<<(ostream &os, const pair<T1, T2> &pa) {
    os << '(' << pa.first << ',' << pa.second << ')'; return os;
}
template <typename T> ostream &operator<<(ostream &os, const vector<T> &vec) {
    for (auto& x : vec) { os << x << ' '; } return os;
}
template <typename T> ostream &operator<<(ostream &os, const vector<vector<T>> &mat) {
    os << endl; for (auto& vec : mat) { os << vec << endl; } return os;
}
void debug() { cerr << endl; }
template <typename Head, typename... Tail> void debug(Head H, Tail... T) {
    cerr << " " << H; debug(T...);
}
template <typename T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return 1; } return 0; }
template <typename T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return 1; } return 0; }
const int INF = (1 << 30) - 1;
const i64 LINF = (1LL << 60) - 1;
// clang-format on

void solve() {
    i64 n, m;
    cin >> n >> m;
    vector<i64> W(n);
    rep(i, n) cin >> W[i];
    vector<i64> L(m), V(m);
    rep(i, m) cin >> L[i] >> V[i];
    i64 ma = 0;
    rep(i, n) chmax(ma, W[i]);
    rep(i, m) if (ma > V[i]) {
        cout << -1 << endl;
        return;
    }

    vector<pii> bridges(m);
    rep(i, m) {
        bridges[i] = {V[i], L[i]};
    }
    bridges.push_back({0, 0});
    sort(all(bridges));
    rep(i, m) {
        chmax(bridges[i + 1].se, bridges[i].se);
    }

    vector<int> perm(n);
    iota(all(perm), 0);
    i64 ans = LINF;

    do {
        vector<vector<i64>> E(n, vector<i64>(n));
        rep(i, n) {
            i64 weight = 0;
            weight = W[perm[i]];
            REP(j, i + 1, n) {
                weight += W[perm[j]];
                int idx = lower_bound(all(bridges), (pii){weight, -LINF}) - bridges.begin();
                if (idx == 0)
                    continue;
                else
                    E[i][j] = bridges[idx - 1].se;
            }
        }
        vector<i64> dist(n);
        rep(i, n) REP(j, i + 1, n) {
            chmax(dist[j], dist[i] + E[i][j]);
        }
        chmin(ans, dist.back());
    } while (next_permutation(all(perm)));
    cout << ans << endl;
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    solve();
    return 0;
}

#include <bits/stdc++.h>
#define rep(i,m,n) for(int i=m;i<n;i++)
#define co(n) cout<<n<<endl
using namespace std;

int main(){ 
  int n,x=0,y=0,ans=100000,c=0;
  cin>>n>>x>>y;
  y*=n;
  rep(i,0,n-1){
    cin>>ans;
    c+=ans;
  }
  if(y-c<=x){
    if(y-c<0) co(0);
    else co(y-c);
  }
  else co(-1);
  
  return 0;
}