#include using namespace std; int main(){ int n,k; cin >> n >> k; vector data(n); for(auto &a:data) cin >> a; sort(data.begin(),data.end()); cout << data[n-1] - data[0] << endl; return 0; }