#include #include using namespace std; int main() { int N, K; int n; int biggest = 1, smallest = 1000; cin >> N >> K; for(int i = 0; i < N; ++i) { cin >> n; biggest = max(biggest, n); smallest = min(smallest, n); } cout << biggest - smallest << endl; return 0; }