#include using namespace std; using ll = long long; using pii = pair; using pll = pair; using vi = vector; using vl = vector; using vs = vector; #define endl ('\n') inline vector range(int64_t stop){vectorv(stop);iota(v.begin(),v.end(),0LL);return v;} inline vector range(int64_t start,int64_t stop){vectorv(stop-start);iota(v.begin(),v.end(),start);return v;} inline vector range(int64_t start,int64_t stop,int64_t step){int s=step>0?(stop-start+step-1)/step:(stop-start+step+1)/step;if(s<=0)return {};vectorv(s);for(int i=0;i> n >> k; int mx, mn; mx = 0; mn = 1e5; for(auto i:range(k)){ int a; cin >> a; mx = max(mx, a); mn = min(mn, a); } cout << mx - mn << endl; return 0; }