package main import "fmt" func MinIntS(v []int) (m int) { if len(v) > 0 { m = v[0] } for i := 1; i < len(v); i++ { if v[i] < m { m = v[i] } } return } func MaxIntS(v []int) (m int) { if len(v) > 0 { m = v[0] } for i := 1; i < len(v); i++ { if v[i] > m { m = v[i] } } return } func main() { var N, K, tmp int fmt.Scan(&N) fmt.Scan(&K) n := make([]int, 0, N) for i := 0; i < N; i++ { fmt.Scan(&tmp) n = append(n, tmp) } min := MinIntS(n) max := MaxIntS(n) fmt.Println(max - min) }