#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int n, i, q, k, a[2001], ans = 10000000001L;
  cin >> n >> k >> q;
  for (i = 0; i < n; i++) cin >> a[i];
  sort(a, a + n);
  for (i = 0; i < (n - q); i++) {
    if ((a[i + q - 1] - a[i]) < ans) ans = (a[i + q - 1] - a[i]);
  }
  cout << ans;
  return 0;
}
