#include "iostream" using namespace std; int main(){ int n, k, l, ma, mi; cin>>n; cin>>k; ma = -1; mi = 100000000; while (n--) { cin>>l; ma = max(ma,l); mi = min(mi,l); } cout<< ma-mi << endl; return 0; }