#include <bits/stdc++.h>
using namespace std;
const int MAXN = 2000 + 10;
int N, M, Q;
int A[MAXN];
int ans = 999999999;
int main() {
  register int i, j;
  scanf("%d%d%d", &N, &M, &Q);
  for (i = 1; i <= N; ++i) scanf("%d", A + i);
  for (i = 1; i <= N - M + 1; ++i) {
    int x = 0, y = 99999999;
    for (j = 1; j <= M; ++j) x = max(x, A[i + j - 1]), y = min(y, A[i + j - 1]);
    ans = min(ans, x - y);
  }
  printf("%d\n", ans);
  return 0;
}
