#include using namespace std; typedef unsigned long long ul; typedef signed long long ll; ul over = 1000000007; int main(void) { cin.tie(0); ios::sync_with_stdio(false); cout << fixed; int n, k; cin >> n >> k; int a[n]; for (int i = 0; i < n; ++i) cin >> a[i]; sort(a, a+n); cout << a[n-1] - a[0] << endl; return 0; }