You are given an array consisting of n integers a_1, a_2, ..., a_n, and a positive integer m. It is guaranteed that m is a divisor of n.

In a single move, you can choose any position i between 1 and n and increase a_i by 1.

Let's calculate c_r (0 ≤ r ≤ m-1) — the number of elements having remainder r when divided by m. In other words, for each remainder, let's find the number of corresponding elements in a with that remainder.

Your task is to change the array in such a way that c_0 = c_1 = ... = c_{m-1} = n/m.

Find the minimum number of moves to satisfy the above requirement.

Input

The first line of input contains two integers n and m (1 ≤ n ≤ 2 ⋅ 10^5, 1 ≤ m ≤ n). It is guaranteed that m is a divisor of n.

The second line of input contains n integers a_1, a_2, ..., a_n (0 ≤ a_i ≤ 10^9), the elements of the array.

Output

In the first line, print a single integer — the minimum number of moves required to satisfy the following condition: for each remainder from 0 to m - 1, the number of elements of the array having this remainder equals n/m.

In the second line, print any array satisfying the condition and can be obtained from the given array with the minimum number of moves. The values of the elements of the resulting array must not exceed 10^{18}.

Examples

Input

6 3
3 2 0 6 10 12


Output

3
3 2 0 7 10 14 


Input

4 2
0 1 2 3


Output

0
0 1 2 3 

import java.util.*;
import java.io.*;
 
public class T490 {
	public static void main(String args[]) {
		Scanner in = new Scanner(System.in);
		PrintWriter out = new PrintWriter(System.out);
		//获取输入n，m
	    int n=in.nextInt(),m=in.nextInt();
	    //定义长度n的数组用于接收数据
	    int[] arr=new int[n];
	    //定义容器数组，count[i]表示余数是i的数组
	    ArrayList<Integer>[] count=new ArrayList[m];
	    //把每个数组坐标都初始化为容器
	    for(int i=0;i<m;i++){
	    	count[i]=new ArrayList<>();
	    }
	    //获取数组，并将数组下标储存于链表容器
	    for(int i=0;i<n;i++){
	    	arr[i]=in.nextInt();
	    	count[arr[i]%m].add(i);
	    }
	    //寻找数据储存量最大的下标
	    int max=0;
	    //指定开始索引
	    int index=m;
	    for(int i=m-1,cur=0;i>=0;i--){
	        cur=count[i].size()-n/m+cur;
	        if(cur>=max){
	            max=cur;
	            index=i;
	        }
	    }
	    long ret=0;
	    Stack<Integer> stack=new Stack<>();
	    for(int i=index;;){
	        if(count[i].size()>n/m){
	            for(int j=n/m;j<count[i].size();j++){
	                stack.add(count[i].get(j));
	            }
	        }else{
	            for(int j=count[i].size();j<n/m;j++){
	                int ind=stack.pop();
	                int mod=arr[ind]%m;
	                long step=(i-mod+m)%m;
	                arr[ind]+=step;
	                ret+=step;
	            }
	        }
	        i++;
	        if(i==m) i=0;
	        if(i==index)break;
	    }
	    out.println(ret);
	    for(int i=0;i<n;i++) out.print(arr[i]+" ");
	    out.flush();
	}
}
