#include <bits/stdc++.h>

using namespace std;

using ll = long long;

const ll MOD = 1000000007;
#define mod(x) (x % MOD + MOD) % MOD

const int dx[4] = {+1, 0, -1, 0};
const int dy[4] = {0, -1, 0, +1};

struct SegmentTreeRSQ
{
    ll size;
    vector<ll> dat;
    const ll INITVAL = 0LL;

    SegmentTreeRSQ(ll n)
    {
        size = 1;
        while (size < n)
            size *= 2;

        dat = vector<ll>(2 * size - 1, INITVAL);
    }

    // update k th value to a
    void update(ll k, ll a)
    {
        k += size - 1;
        dat[k] = a;

        while (k > 0)
        {
            k = (k - 1) / 2;
            dat[k] = dat[k * 2 + 1] + dat[k * 2 + 2];
        }
    }

    ll query(ll a, ll b, ll k = 0, ll l = 0, ll r = -1)
    {
        if (r < 0)
            r = size;
        if (r <= a || b <= l)
            return INITVAL;
        if (a <= l && r <= b)
            return dat[k];
        else
        {
            ll vl = query(a, b, k * 2 + 1, l, (l + r) / 2);
            ll vr = query(a, b, k * 2 + 2, (l + r) / 2, r);
            return vl + vr;
        }
    }
};

int main()
{
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    ll h, w, m;
    cin >> h >> w >> m;
    vector<ll> minh(h), minw(w);
    vector<vector<ll>> obs(h);
    fill(minh.begin(), minh.end(), w);
    fill(minw.begin(), minw.end(), h);
    for (int i = 0; i < m; i++)
    {
        ll ht, wt;
        cin >> ht >> wt;
        ht--;
        wt--;
        minh[ht] = min(minh[ht], wt);
        minw[wt] = min(minw[wt], ht);
        obs[ht].push_back(wt);
    }
    SegmentTreeRSQ sg(w);
    ll cnt = 0;
    for (int j = 0; j < minh[0]; j++)
        cnt += minw[j];
    //cout << cnt << endl;
    for (int j = minh[0]; j < w; j++)
        sg.update(j, 1);
    for (int i = 1; i < minw[0]; i++)
    {
        cnt += sg.query(0, minh[i]);
        for (ll j : obs[i])
            sg.update(j, 1);
    }
    cout << cnt << endl;
}

#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef long double LD;
typedef pair<LL,LL> pii;
typedef pair<LL,pii> ppi;
typedef pair<pii,pii> ppp;
#define FOR(i, n) for(int i = 1; i<=n; i++)
#define F0R(i, n) for(int i = 0; i<n; i++)
#define mp make_pair
#define pb push_back
#define f first
#define s second

template<typename A, typename B> ostream& operator<<(ostream &cout, pair<A, B> const &p) { return cout << "(" << p.f << ", " << p.s << ")"; }
template<typename A> ostream& operator<<(ostream &cout, vector<A> const &v) {cout << "["; F0R(i, v.size()) {if (i) cout << ", "; cout << v[i];} return cout << "]";}

//var 
const LL INF = 1e18;
LL T, n, a[105], x, dp[105][105];

void filldp(LL g){
	F0R(i, g+1) F0R(j, g+1) dp[i][j] = -INF;
	dp[0][0] = 0;

	FOR(i, n){
		for(int j = g; j>=1; j--){
			for(int k = 0; k<g; k++){
				if(dp[j-1][k] < 0) continue;
				dp[j][(k + a[i]) % g] = max(dp[j][(k + a[i])%g], 
											dp[j-1][k] + a[i]);
			}
		}
	}

	//cout << dp[g][0] << '\n';
}

void solve(){
	cin >> n >> x;
	FOR(i, n) cin >> a[i];

	LL ans = INF;
	FOR(i, n){
		filldp(i);
		LL mxval = dp[i][x%i];
		if(mxval < 0) continue;
		LL tt = (x - mxval)/i;
		ans = min(ans, tt);
	}

	cout << ans << '\n';
}

int main(){
	ios_base::sync_with_stdio(0); 
	cin.tie(0);

	T = 1;
	//cin >> T;
	FOR(t, T)
		solve();

	cout.flush();
	return 0;
}