AT_abc450_d [ABC450D] Minimize Range

Description

You are given a sequence $ A $ of $ N $ positive integers and a positive integer $ K $ . You can perform the following operation on the sequence $ A $ any number of times. - Choose an integer $ i $ with $ 1 \leq i \leq N $ , and add $ K $ to $ A_i $ . Find the minimum possible value of $ \max(A) - \min(A) $ .

Input Format

The input is given from Standard Input in the following format: > $ N $ $ K $ $ A_1 $ $ A_2 $ $ \dots $ $ A_N $

Output Format

Output the answer on a single line.

Explanation/Hint

### Sample Explanation 1 First, choosing $ i=1 $ makes the sequence $ A=(13,21,9) $ . Next, choosing $ i=3 $ makes the sequence $ A=(13,21,19) $ . Next, choosing $ i=1 $ makes the sequence $ A=(23,21,19) $ . At this point, $ \max(A)-\min(A)=23-19=4 $ . It is impossible to make $ \max(A)-\min(A) $ at most $ 3 $ , so the answer is $ 4 $ . ### Constraints - $ 1 \leq N \leq 2 \times 10^5 $ - $ 1 \leq K \leq 10^9 $ - $ 1 \leq A_i \leq 10^9 $ - All input values are integers.