import std.stdio, std.conv, std.string, std.range, std.math, std.bigint, std.algorithm, core.bitop; void main() { auto N = readln.chomp.to!int; auto K = readln.chomp.to!int; auto n = stdin.byLineCopy.array.to!(int[]); (n.reduce!max - n.reduce!min).writeln; }