#include <bits/stdc++.h>
using namespace std;

#define int long long
#define puts(x) cout<<x<<endl
#define inf 100000000000
#define minf -LLONG_MAX
#define all(v) (v).begin(),(v).end()
#define odd(x) x%2==1
#define YES cout<<"YES\n"
#define NO cout<<"NO\n"
#define Yes cout<<"Yes\n"
#define No cout<<"No\n"
#define present(c,x) (c.find(x) != c.end())
#define ANS cout<<ans<<endl;
#define sz(x) x.size()
#define desc greater<int>()
#define nl cout<<endl
#define modP(x) (x+P)%P
#define rep(i,x,y)  for(int i=x;i<y;i++)
#define vll vector<long long>
#define ll long long int


const int MAX_N = 1e5 + 1;
const int P = 1e9 + 7;
const int INF = 1e9;
const int LINF = 1e18;



void pra(int a[], int n)
{
    for (int i = 0;i<n;i++)
        cout << a[i] << " ";
    cout << '\n';
}


void prv(vector<int> &a, int n)
{
    int i = 0;
    for(int x : a)
    {
        i++;
        cout << x << " ";
        if(i == n) break;
    }
    cout << '\n';
}



void prvp(vector<pair<int,int>> vp, int n)
{
    int i = 0;
    for (auto x : vp)
    {
        i++;
        cout << x.first << " " << x.second << '\n';
        if(i == n) break;
    }

    cout << '\n';
}
int mod(int n) {return (n % P + P) % P; }
int modM(int n, int m) { return ((n % P * m % P) + P) % P; }
int modA(int n, int m) { return ((n % P + m % P) + P) % P; }
int modS(int n, int m) { return ((n % P - m % P) + P) % P; }



//*******************************************************************************************************************************************************************************************************
void solve() {
    int h,w,n ,m ;
    cin>>h>>w>>n>>m;
    int a[h+1][w+1];
    memset(a,-1, sizeof(a));
    for (int i=0;i<n;i++){
        int r,c ;
        cin>>r>>c;
        a[r][c]=1;
    }
    for(int i=0;i<m;i++){
        int r,c;
        cin>>r>>c;
        a[r][c]=0;
    }
    int b[h+1][w+1];
    memset(b,0,sizeof(b));
    for(int i=1;i<=h;i++){
        int l=0;
        for(int j=1;j<=w;j++){
            if(a[i][j]==1)l=1;
            else if(a[i][j]==0)l=0;
            b[i][j]|=l;
        }
    }
    for(int i=1;i<=h;i++){
        int l=0;
        for(int j=w;j>=1;j--){
            if(a[i][j]==1)l=1;
            else if(a[i][j]==0)l=0;
            b[i][j]|=l;
        }
    }
    for(int j=1;j<=w;j++){
        int l=0;
        for(int i=1;i<=h;i++){
            if(a[i][j]==1)l=1;
            else if(a[i][j]==0)l=0;
            b[i][j]|=l;
        }
    }
    for(int j=1;j<=w;j++){
        int l=0;
        for(int i=h;i>=1;i--){
            if(a[i][j]==1)l=1;
            else if(a[i][j]==0)l=0;
            b[i][j]|=l;
        }
    }
    int ans =0;
    for(int i=1;i<=h;i++)
        for (int j=1;j<=w;j++)
            if(b[i][j])ans++;

    cout  <<  ans  <<endl;




}
//************************************************************************************************************************************************************************************************************************

signed main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    // freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);
   // int tc; cin >> tc;
int tc =1;


    for (int t = 1; t <= tc; t++) {
        //cout << "Case #" << t  << ": ";
        solve();
    }
}




#include <bits/stdc++.h>
using namespace std;
#ifdef LOCAL
#include "debug.h"
#else
#define dump(...)
#endif
#define endl '\n'
//#define int long long
#define FOR(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define REP(i, x) for (int i = 0; i < (int)(x); i++)
#define REPS(i, x) for (int i = 1; i <= (int)(x); i++)
#define RREP(i, x) for (int i = ((int)(x)-1); i >= 0; i--)
#define RREPS(i, x) for (int i = ((int)(x)); i > 0; i--)
#define INF 2147483647
#define LLINF 9223372036854775807LL
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define BIT(n) (1LL << (n))
#define TOUPPER(s) transform(s.begin(), s.end(), s.begin(), ::toupper)
#define TOLOWER(s) transform(s.begin(), s.end(), s.begin(), ::tolower)
#define FILLZERO(s, n)                      \
    do {                                    \
        ostringstream os;                   \
        os << setw(n) << setfill('0') << s; \
        s = os.str();                       \
    } while (0);
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end())  // sortしてからつかうこと

using ll = long long;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using pi = pair<int, int>;
template <typename T>
using Pq = priority_queue<T>;
template <typename T>
using pQ = priority_queue<T, vector<T>, greater<T>>;

template <typename T>
vector<T> make_vec(size_t a, T n) {
    return vector<T>(a, n);
}
template <typename T, typename... Ts>
auto make_vec(size_t a, Ts... ts) {
    return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}
template <class T>
inline bool chmax(T &a, T b) {
    if (a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
inline bool chmin(T &a, T b) {
    if (a > b) {
        a = b;
        return 1;
    }
    return 0;
}
template <typename T>
bool isProductOverflow(T a, T b) {
    return (a > numeric_limits<T>::max() / b);
}
template <typename T>
istream &operator>>(istream &is, vector<T> &vec) {
    for (T &x : vec) is >> x;
    return is;
}

__attribute__((constructor)) void ioInit() {
    std::cin.tie(nullptr);
    std::ios_base::sync_with_stdio(false);
    cout << std::fixed << std::setprecision(10);
}

constexpr ll MOD = 1e9 + 7;
// constexpr ll MOD = 998244353;
int dx[8] = {1, 0, -1, 0, 1, 1, -1, -1};
int dy[8] = {0, 1, 0, -1, 1, -1, 1, -1};
ll A, B, C, D, E, F, G, H, N, M, L, K, P, Q, R, W, X, Y, Z;
string S, T;
ll ans = 0;

signed main() {
    cin >> N >> X;
    ans = LLINF;
    vector<ll> a(N);
    cin >> a;
    REPS(n, N) {
        auto dp = make_vec<ll>(N + 1, N + 1, N + 1, 0LL);
        REP(i, N) {
            REP(j, N) {
                REP(k, N) {
                    chmax(dp[i + 1][j][k], dp[i][j][k]);
                    if (dp[i][j][k] > 0 or (j == 0 and k == 0))
                        chmax(dp[i + 1][j + 1][(k + a[i]) % n], dp[i][j][k] + a[i]);
                }
            }
        }
        REP(k, N) {
            if ((X - dp[N][n][k]) % n == 0 and dp[N][n][k] > 0) {
                chmin(ans, (X - dp[N][n][k]) / n);
            }
        }
        dump(n, dp);
    }
    cout << ans << endl;
}