#include int main(void){ int i, j, tmp, a, N, K; int n[] = {0}; scanf ("%d%d", &N, &K); for ( i = 0; i < N; i++){ scanf ("%d",n[i]); } for ( i = 0; i < N - 1; i++){ for ( j = i +1; j < N; j++){ if ( n[i] > n[j]) tmp = n[i]; n[i] = n[j]; n[j] = tmp; } } a = n[N - 1] - n[0]; printf ( "%d", a); return 0; }