SOLVE
LATER
Monk likes to experiment with algorithms. His one such experiment is using modulo in sorting.He describes an array modulo sorted as:
Given an integer k, we need to sort the values in the array according to their modulo with k. That is, if there are two integers a and b, and \(a\%k < b\%k\), then a would come before b in the sorted array. If \(a\%k=b\%k\) , then the integer which comes first in the given array remains first in the sorted array.
Given an initial array, you need to print modulo sorted array.
Input:
The first line consists of two integers N and k, N being the number of elements in the array and k is the number with which we need to take the modulo.
The next line consists of N space separated integers , denoting the elements of the array A.
Output:
Print the modulo sorted array of the given array.
Constraints:
\(1 \le N \le 10^4\)
\(1 \le k \le 10^9\)
\(1 \le A[i] \le 10^9\); \(1\le i \le N\)
12%6=0
18%6=0
17%6=5
65%6=5
46%6=4
So, the sorted order is: 12 18 46 17 65
12 and 18 have same result on modulo , so, 12 remains first in sorted array as it is first in given array