#include <bits/stdc++.h>
using namespace std;
template <typename T>
ostream& operator<<(ostream& os, vector<T>& v) {
  for (int i = 0; i < (v.size()); i++) {
    os << v[i] << (i == v.size() - 1 ? "" : " ");
  }
  return os;
}
template <typename T>
istream& operator>>(istream& is, vector<T>& v) {
  for (T& x : v) {
    is >> x;
  }
  return is;
}
int main() {
  int n, k, q;
  cin >> n >> k >> q;
  vector<long long> a(n);
  cin >> a;
  vector<pair<long long, long long>> p(n);
  for (int i = 0; i < (n); i++) {
    p[i] = make_pair(a[i], i);
  }
  sort((p).begin(), (p).end());
  long long ans = 1e9;
  for (int len = (k); len < (n + 1); len++) {
    long long maxi = 0, mini = 1e9;
    for (int j = 0; j < (len); j++) {
      maxi = max(maxi, p[j].second);
      mini = min(mini, p[j].second);
    }
    if (maxi - mini == len) ans = abs(p[0].second - p[0 + len].second);
    for (int j = (1); j < (n - len); j++) {
      if (maxi == p[j - 1].second) maxi = 0;
      if (mini == p[j - 1].second) mini = 1e9;
      maxi = max(maxi, p[j + len].second);
      mini = min(mini, p[j + len].second);
      if (maxi - mini == len) ans = abs(p[j].second - p[j + len].second);
    }
  }
  cout << ans << endl;
}
