fun main(args: Array) { val N = readLine()!!.toInt() val K = readLine()!!.toInt() val a = mutableListOf() for (i in 0 until N) { val n = readLine()!!.toInt() a.add(n) } println(a.max()!! - a.min()!!) }