#include #include #include int main() { int N, K; std::cin >> N; std::cin >> K; std::vector V(N); for (int i = 0; i < N; i++) { std::cin >> V.at(i); } int max = *max_element(V.begin(), V.end()); int min = *min_element(V.begin(), V.end()); std::cout << max - min << std::endl; }