#include using namespace std; int main() { int N, K; cin >> N >> K; vector x(N); for (int i = 0; i < N; i++) { cin >> x[i]; } sort(begin(x), end(x)); cout << x[N - 1] - x[0] << endl; }