#include using namespace std; int main() { int n, k, max, min, tmp; cin >> n; cin >> k; cin >> max; min = max; for (int i = 1; i < n; i++) { cin >> tmp; if (tmp < min) { min = tmp; } if (tmp > max) { max = tmp; } } cout << max - min << endl; return 0; }