#include <iostream>

using namespace std;

int n, m, k, l, num;
int w[11][100000];
bool ok[11];

int get(int fl, int sl)
{
  int res = 0;
  for (int i = sl; i < sl + k; i++)
    res+=w[fl][i] * (1 << (k + sl - i - 1));
//  cout << res << endl;
  return res;
}

int main()
{
  freopen("B.in", "r", stdin);
  freopen("B.out", "w", stdout);

  cin >> n >> m >> k >> l;

  for (int i = 0; i < l; i++)
  {
    int x; cin >> x; ok[x-1] = true; num+=(1 << (k - x));
  }

  //cout << num << endl;

  int fl = 0, lt = -1;

  for (int i = 0; i < n; i++)
  {
    lt++; 
    
    while (true)
    {
      bool bad = false;
      for (int j = 0; j < m; j++)
        if (j != fl)
          if ( (get(j, lt) & num) != 0 ) bad = true;

      if (bad) lt++; else break;
    }

    for (int j = 0; j < k; j++)
      if (ok[j]) w[fl][lt + j] = 1;
    if (fl == m-1) fl = 0; else fl++;
  }

  /*for (int i = 0; i < n; i++)
  {
    for (int j = 0; j < 20; j++)
      cout << w[i][j] << " ";
    cout << endl;
  }*/
  cout << lt + k;

  return 0;
}