#include <iostream> #include <vector> #include <algorithm> #include <cmath> #include <stack> #include <queue> #include <set> #include <map> #include <unordered_map> #include <chrono> #include <random> #include <functional> #include <utility> #include <cassert> #pragma GCC optimize("O3") #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native") #pragma comment(linker, "STACK:36777216") using namespace std; using i64 = int64_t; constexpr i64 MOD = 1e9 + 7; mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count()); using vi = vector<i64>; using vvi = vector<vi>; using vvvi = vector<vvi>; using ii = pair<i64, i64>; int main() { int n, k; cin >> n >> k; vi ns; for (int i = 0; i < n; i++) { int a; cin >> a; ns.push_back(a); } sort(ns.begin(), ns.end()); cout << ns.back() - ns.front() << endl; }