Help Chokro

Limits 1s, 512 MB

Pias and Chokro are good friends. Pias's birthday is coming soon. So, Chokro wants to gift Pias an array on his birthday. Initially, Chokro has an array $A$ of size $n$ which has values $A_{1}, A_{2}, ..., A_{n}$.

Chokro can perform the following operations on this array any number of times (possibly zero):

  1. $A_{i} = A_{i} + 1$.
  2. $A_{i} = A_{i} - 1$.

Chokro knows that Pias's lucky number is $k$, and he likes an array of equal values. So, to make him more excited Chokro wants to convert the array such that $A_{1} = A_{2} = ... = A_{n}$ and $ A_{i} \% k = 0$ for all $i$ $(1 \leq i \leq n)$.

As Chokro's online classes are starting soon he doesn't have much time. So, he thought that it would be better to write a code to know the minimum number of operations required to convert the array so that Pias likes that.

But Chokro is afraid of programming. So, he wants your help. Can you help Chokro?


First line will contain two integers $n$, $k$ ($1 \leq n, k \leq 10^{6}$) the size of the array and Pias's lucky number respectively.

Next line will contain n space separated integers $A_{1}$, $A_{2}$, ..., $A_{n}$ ($0 \leq A_{i} \leq 10^{6}$).


Output a single integer the minimum number of operations Chokro needs to convert the array.


5 3
1 8 7 6 4
6 2
3 5 7 12 9 0