#include <iostream>

using namespace std;

int main()
{
    int n,k,mx=-1,mi=100;
    cin>>n>>k;
    int a[n];
    for (int i=0;i<n;i++){
        cin>>a[i];
        if(a[i]>mx)
            mx=a[i];
        if(a[i]<mi)
            mi=a[i];}
    cout<<mx-mi;
return 0;
}