$N = trim(fgets(STDIN)); $K = trim(fgets(STDIN)); $Nx = array(); for ($i = 0; $i < $N; $i++) $Nx[] = trim(fgets(STDIN)); sort($Nx); echo ($Nx[$N-1] - $Nx[0]) . "\n";