Funny Confusion
Let A
be an array with N
elements A[1]
, ..., A[N]
. The maximum and minimum values of this array are denoted as max(A) and min(A), respectively. The sum of all elements in the array is represented by S
, where S = A[1]
+ A[2]
+ ... + A[N]
. Each element of the array is then replaced by the difference between S
and that element: A[i]
:= S - A[i]
, for 1 ≤ i ≤ N. This transformation is known as the Confuse operation.
Your task is to write a program that, given an array B
, which is the result of applying the Confuse operation K
times to an initial array A
, computes the difference: max(A) - min(A).
Input
The first line of input contains two integers N
and K
. Here, N
is the number of elements in the array B
(2 ≤ N
≤ 10000), and K
is the number of times the Confuse operation has been applied to the original array A
(1 ≤ K
≤ 100). The second line contains N
integers, which are the elements of the array B
. Each element of B
is an integer between -2000000000 and 2000000000.
Output
Output a single integer, which is the difference between max(A) and min(A).