Helen works in Metropolis airport. She is responsible for creating a departure schedule. There are n flights that must depart today, the i-th of them is planned to depart at the i-th minute of the day.

Metropolis airport is the main transport hub of Metropolia, so it is difficult to keep the schedule intact. This is exactly the case today: because of technical issues, no flights were able to depart during the first k minutes of the day, so now the new departure schedule must be created.

All n scheduled flights must now depart at different minutes between (k + 1)-th and (k + n)-th, inclusive. However, it's not mandatory for the flights to depart in the same order they were initially scheduled to do so — their order in the new schedule can be different. There is only one restriction: no flight is allowed to depart earlier than it was supposed to depart in the initial schedule.

Helen knows that each minute of delay of the i-th flight costs airport ci burles. Help her find the order for flights to depart in the new schedule that minimizes the total cost for the airport.

Input

The first line contains two integers n and k (1 ≤ k ≤ n ≤ 300 000), here n is the number of flights, and k is the number of minutes in the beginning of the day that the flights did not depart.

The second line contains n integers c1, c2, ..., cn (1 ≤ ci ≤ 107), here ci is the cost of delaying the i-th flight for one minute.

Output

The first line must contain the minimum possible total cost of delaying the flights.

The second line must contain n different integers t1, t2, ..., tn (k + 1 ≤ ti ≤ k + n), here ti is the minute when the i-th flight must depart. If there are several optimal schedules, print any of them.

Example

Input

5 2
4 2 1 10 2


Output

20
3 6 7 4 5 

Note

Let us consider sample test. If Helen just moves all flights 2 minutes later preserving the order, the total cost of delaying the flights would be (3 - 1)·4 + (4 - 2)·2 + (5 - 3)·1 + (6 - 4)·10 + (7 - 5)·2 = 38 burles. 

However, the better schedule is shown in the sample answer, its cost is (3 - 1)·4 + (6 - 2)·2 + (7 - 3)·1 + (4 - 4)·10 + (5 - 5)·2 = 20 burles.


 
    	        			/*
 * Author- Priyam Vora
 * BTech 2nd Year DAIICT
 */
     
     
        		    import java.awt.Checkbox;
import java.awt.Point;
import java.io.*;
        		    import java.math.*;
        		    import java.util.*;
import java.util.Map.Entry;

import javax.print.attribute.SetOfIntegerSyntax;
import javax.swing.plaf.FontUIResource;
    	     
        		    public class Main{
        		  	private static InputStream stream;
        		    	private static byte[] buf = new byte[1024];
        		    	private static int curChar;
        		    	private static int numChars;
        		    	private static SpaceCharFilter filter;
        		    	private static PrintWriter pw;
        		    	private static long count = 0,mod=1000000007;
        		    //	private static TreeSet<Integer> ts=new TreeSet[200000];
public final static int INF = (int) 1E9;

public static void main(String args[]) {
	InputReader(System.in);
	pw = new PrintWriter(System.out); 
    new Thread(null ,new Runnable(){
       public void run(){
           try{
               solve();
               pw.close();
           } catch(Exception e){
               e.printStackTrace();
           }
       }
   },"1",1<<26).start();
   }
    static StringBuilder sb;
    public static void test(){
    	 sb=new StringBuilder();
    	int t=nextInt();
    	while(t-->0){
    		solve();
    	}
    	pw.println(sb);
    }
    public static long pow(long n, long p,long mod) {
		if(p==0)
			return 1;
		if(p==1)
			return n%mod;
		if(p%2==0){
			long temp=pow(n, p/2,mod);
		return (temp*temp)%mod;
		}else{
			 	long temp=pow(n,p/2,mod);
			 	temp=(temp*temp)%mod;
			 	return(temp*n)%mod;
			 	
		}
	}
    public static long pow(long n, long p) {
		if(p==0)
			return 1;
		if(p==1)
			return n;
		if(p%2==0){
			long temp=pow(n, p/2);
		return (temp*temp);
		}else{
			 	long temp=pow(n,p/2);
			 	temp=(temp*temp);
			 	return(temp*n);
			 	
		}
	}
    public static void Merge(long a[],int p,int r){
        if(p<r){
            int q = (p+r)/2;
            Merge(a,p,q);
            Merge(a,q+1,r);
            Merge_Array(a,p,q,r);
        }
    }
    public static void Merge_Array(long a[],int p,int q,int r){
       long b[] = new long[q-p+1];
        long c[] = new long[r-q];
        for(int i=0;i<b.length;i++)
            b[i] = a[p+i];
        for(int i=0;i<c.length;i++)
            c[i] = a[q+i+1];
        int i = 0,j = 0;
        for(int k=p;k<=r;k++){
            if(i==b.length){
                a[k] = c[j];
                j++;
            }
            else if(j==c.length){
                a[k] = b[i];
                i++;
            }
            else if(b[i]<c[j]){
                a[k] = b[i];
                i++;
            }
            else{
                a[k] = c[j];
                j++;
            }
        }
    }
    
   static  int digitDegree(int n) {
    	return times(n,0);
    	}

    static 	int times(int n,int cnt){
    	    if(n==1){
    	        return cnt;
    	    }
    	    String s=String.valueOf(n);
    	    int ans=0;
    	    for(int i=0;i<s.length();i++){
    	        ans+=(s.charAt(i)-'0');
    	    }
    	    return times(ans,cnt+1);
    	}

	public static long gcd(long x, long y) {
		if (x == 0)
			return y;
		else
			return gcd( y % x,x);
	}	public static boolean isPrime(int n) {
	// Corner cases
		if (n <= 1)
			return false;
		if (n <= 3)
			return true;
 
		// This is checked so that we can skip 
// middle five numbers in below loop
		if (n % 2 == 0 || n % 3 == 0)
			return false;
 
		for (int i = 5; i * i <= n; i = i + 6)
			if (n % i == 0 || n % (i + 2) == 0)
				return false;
 
		return true;
	}
        static LinkedList<Integer> adj[];
        static boolean Visited[];
        static HashSet<Integer> exc;
        static long oddsum[]=new long[1000001];
        static long co=0,ans=Integer.MAX_VALUE;
    
     
      
       
        static int[] levl;
        static int[] no;
        static int n,m;
        
        //ind frog crab
    public static void solve(){

    	int n=nextInt();
    	int k=nextInt();
    	
    	long a[]=nextLongArray(n);
    	Pair p[]=new Pair[n];
    	for(int i=0;i<n;i++){
    		p[i]=new Pair(i+1, a[i]);
    	}
    	Arrays.sort(p);
    	TreeSet<Integer> ts=new TreeSet<Integer>();
    	for(int i=k+1;i<=k+n;i++){
    		ts.add(i);
    	}
    	long new_arr[]=new long[n];
    	for(int i=0;i<n;i++){
    		long time=p[i].no_vert;
    		long min_diff=Integer.MAX_VALUE;
    		long exact=-1;
    		if(ts.ceiling((int)time)!=null){
    			min_diff=(ts.ceiling((int)time)-time);
    		exact=ts.ceiling((int)time);
    		}
    		
    		
    		new_arr[(int)p[i].no_vert-1]=exact;
    		ts.remove((int)exact);
    		
    	}
    	long ans=0;
    	for(int i=0;i<n;i++){
    		ans+= (Math.abs(new_arr[i]-(i+1)))*a[i];
    	}
    	pw.println(ans);
    	pArray(new_arr);
    }
  static int deg=0;

  
  private static void dfs(int start){
	  Visited[start]=true;
	  deg+=adj[start].size();
	  no_vert++;
	  for(int i:adj[start]){
		  if(!Visited[i])
			  dfs(i);
	  }
  }
    
    public static String reverseString(String s) {
		StringBuilder sb = new StringBuilder(s);
		sb.reverse();
		return (sb.toString());
	}
    
    
   private static void BFS(int sou){
    	Queue<Integer> q=new LinkedList<Integer>();
    	q.add(sou);
    	Visited[sou]=true;
    	levl[sou]=0;
    	while(!q.isEmpty()){
    		int top=q.poll();
    		
    		for(int i:adj[top]){
    			//pw.println(i+" "+top);
			if(!Visited[i])
			{
				
				q.add(i);
				levl[i]=levl[top]+1;
			}
			
			Visited[i]=true;
			
			}
		}
	}
	

private static long ncr(int n,int k){
	if (k < 0 || k > n) return 0;
    if (n-k < k) k = n-k;

    BigInteger x = BigInteger.ONE;
    for (int i = 1; i <= k; i++) {
        x = x.multiply(new BigInteger(""+(n-i+1)));
        x = x.divide(new BigInteger(""+i));
				        }
			
				return x.longValue();
				    }
    		       private  static long fact(long count){
    		        	long ans=1;
    		        	for(int i=1;i<=count;i++){
    		        		ans*=i;
    		        	}
    		        	return ans;
    		        }
    		        
    		        
    		        static int state=1;
    		        static long no_exc=0,no_vert=0;
    		      static Stack<Integer> st;
    		      static HashSet<Integer> inset;
    		        private static void topo(int curr){
    		        	
    		        	Visited[curr]=true;
    		        	inset.add(curr);
    		        	for(int x:adj[curr]){
    		        		if(adj[x].contains(curr) || inset.contains(x)){
    		        			state=0;
    		        			return;
    		        		}
    		        		if(state==0)
    		        			return;
    		        		
    		        	}
    		        	st.push(curr);
    		        	
    		        	inset.remove(curr);
    		        }
    		        static HashSet<Integer> hs;
    		       
    		     	private static void buildgraph(int n){
    		    		adj=new LinkedList[n+1];
    		    		Visited=new boolean[n+1];
    		    		levl=new int[n+1];
    		    		no=new int[n+1];
    		    		for(int i=0;i<=n;i++){
    		    			adj[i]=new LinkedList<Integer>();
    		    		
    		    		}
 
 
    		    	}
    		     	
    		    	// To Get Input
// Some Buffer Methods
 
    		     	public static void sort(long a[]){
    		     		Merge(a, 0, a.length-1);
    		     	}
    		    	public static void InputReader(InputStream stream1) {
    		    		stream = stream1;
    		    	}
 
    		    	private static boolean isWhitespace(int c) {
    		    		return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
    		    	}
 
    		    	private static boolean isEndOfLine(int c) {
    		    		return c == '\n' || c == '\r' || c == -1;
    		    	}
 
    		    	private static int read() {
    		    		if (numChars == -1)
    		    			throw new InputMismatchException();
    		    		if (curChar >= numChars) {
    		    			curChar = 0;
    		    			try {
    		    				numChars = stream.read(buf);
    		    			} catch (IOException e) {
    		    				throw new InputMismatchException();
    		    			}
    		    			if (numChars <= 0)
    		    				return -1;
    		    		}
    		    		return buf[curChar++];
    		    	}
 
    		    	private static int nextInt() {
    		    		int c = read();
    		    		while (isSpaceChar(c))
    		    			c = read();
    		    		int sgn = 1;
    		    		if (c == '-') {
		sgn = -1;
		c = read();
	}
	int res = 0;
	do {
		if (c < '0' || c > '9')
			throw new InputMismatchException();
		res *= 10;
		res += c - '0';
    		    			c = read();
    		    		} while (!isSpaceChar(c));
    		    		return res * sgn;
    		    	}
 
    		    	private static long nextLong() {
    		    		int c = read();
    		    		while (isSpaceChar(c))
    		    			c = read();
    		    		int sgn = 1;
    		    		if (c == '-') {
		sgn = -1;
		c = read();
	}
	long res = 0;
	do {
		if (c < '0' || c > '9')
			throw new InputMismatchException();
		res *= 10;
		res += c - '0';
    		    			c = read();
    		    		} while (!isSpaceChar(c));
    		    		return res * sgn;
    		    	}
 
    		    	private static String nextToken() {
    		    		int c = read();
    		    		while (isSpaceChar(c))
    		    			c = read();
    		    		StringBuilder res = new StringBuilder();
    		    		do {
    		    			res.appendCodePoint(c);
    		    			c = read();
    		    		} while (!isSpaceChar(c));
    		    		return res.toString();
    		    	}
 
    		    	private static String nextLine() {
    		    		int c = read();
    		    		while (isSpaceChar(c))
    		    			c = read();
    		    		StringBuilder res = new StringBuilder();
    		    		do {
    		    			res.appendCodePoint(c);
    		    			c = read();
    		    		} while (!isEndOfLine(c));
    		    		return res.toString();
    		    	}
 
    		    	private static int[] nextIntArray(int n) {
    		    		int[] arr = new int[n];
    		    		for (int i = 0; i < n; i++) {
    		    			arr[i] = nextInt();
    		    		}
    		    		return arr;
    		    	}
 
    		    	private static long[][] next2dArray(int n, int m) {
    		    		long[][] arr = new long[n][m];
    		    		for (int i = 0; i < n; i++) {
    		    			for (int j = 0; j < m; j++) {
    		    				arr[i][j] = nextLong();
    		    			}
    		    		}
    		    		return arr;
    		    	}
    		    	private static char[][] nextCharArray(int n,int m){
    		    		char [][]c=new char[n][m];
    		    		for(int i=0;i<n;i++){
    		    			String s=nextLine();
    		    			for(int j=0;j<s.length();j++){
    		    				c[i][j]=s.charAt(j);
    		    			}
    		    		}
    		    		return c;
    		    	}
 
    		    	private static long[] nextLongArray(int n) {
    		    		long[] arr = new long[n];
    		    		for (int i = 0; i < n; i++) {
    		    			arr[i] = nextLong();
    		    		}
    		    		return arr;
    		    	}
 
    		    	private static void pArray(int[] arr) {
    		    		for (int i = 0; i < arr.length; i++) {
    		    			pw.print(arr[i] + " ");
    		    		}
    		    		pw.println();
    		    		return;
    		    	}
 
    		    	private static void pArray(long[] arr) {
    		    		for (int i = 0; i < arr.length; i++) {
    		    			pw.print(arr[i] + " ");
    		    		}
    		    		pw.println();
    		    		return;
    		    	}
 
    		    	private static void pArray(boolean[] arr) {
    		    		for (int i = 0; i < arr.length; i++) {
    		    			pw.print(arr[i] + " ");
    		    		}
    		    		pw.println();
    		    		return;
    		    	}
 
    		    	private static boolean isSpaceChar(int c) {
    		    		if (filter != null)
    		    			return filter.isSpaceChar(c);
    		    		return isWhitespace(c);
    		    	}
 
    		    	private interface SpaceCharFilter {
    		    		public boolean isSpaceChar(int ch);
    		    	}
    		    	
    		    	private static void merge_sort(int a[],int p,int q){
    		    		if(p>q)
    		    			return;
    		    		int mid=(p+q)/2;
    		    		int l[]=new int[mid];
    		    		int r[]=new int[a.length - mid];
    		    		for(int i=0;i<mid;i++){
    		    			l[i]=a[i];
    		    		}
    		    		for(int i=mid;i<a.length;i++)
    		    			r[i]=a[i];
    		    		merge_sort(l,p,mid);
    		    		merge_sort(r,mid+1,q);
    		    		merge(l,r,a);
    		    	}
    		    	private static void merge(int l[],int r[],int a[]){
    		    		int i=0,j=0,k=0;
    		    		int nl=l.length;
    		    		int nr=r.length;
    		    		while(i<nl && j<nr){
    		    			if(l[i]<r[j]){
    		    				a[k]=l[i];
    		    				k++;
    		    				i++;  
    		    			}else {
    		    				a[k]=r[j];
    		    				k++;
    		    				j++;
    		    			}
    		    				
    		    			}
    		    		while(i<nl){
    		    			a[k]=l[i];
    		    			i++;
    		    			k++;
    		    		}
    		    		while(j<nr){
    		    			a[k]=r[j];
    		    			j++;
    		    			k++;
    		    		}
    		    	}
 
 
}
    		    
    		           		    class Node{
    		    	int to;
    		    	long dist;
    		    	Node(int to,long dist){
    		    		this.to=to;
    		    		this.dist=dist;
    		    	}
    		    	
    		    }
    		   /* class Pair implements Comparable<Pair>{
	
	
	int ele,ind;
	Pair(int ele,int ind){
	
		this.ele=ele;
		this.ind=ind;
	
	}
	@Override
	public int compareTo(Pair o) {

			
			return ele-o.ele;
	}
	public int hashCode() {
			//int hu = (int) (x ^ (x >>> 32));
			//int hv = (int) (y ^ (y >>> 32));
			//int hw = (int) (mass ^ (mass >>> 32));
			//return 31 * hu + hv ;
		return 0;
		}
		public boolean equals(Object o) {
			Pair other = (Pair) o;
		//	return x == other.x && y == other.y;
		return false;
		}
}  */class Dsu{
private int rank[], parent[] ,n;
int str[];
private static int[] parent1;
Dsu(int size){
	this.n=size+1;
	rank=new int[n];
	//parent=new int[n];
    		    		    		parent=new int[n];
    		    		    		str=new int[n];
    		    		    	makeSet();
    		    		
    		    		    	}
    		    		    	
    		    		    	void makeSet(){
    		    		    		for(int i=0;i<n;i++){
    		    		    			parent[i]=i;
    		    		    			str[i]=i;
    		    		    		}
    		    		    	}
    		    		    	
    		    		    	int find(int x){
    		    		    		if(parent[x]!=x){
    		    		    			
    		    		    			parent[x]=find(parent[x]);
    		    		    		}
    		    		    		return parent[x];
    		    		    	}
    		    		    
    		    		    	
    		    		    	boolean union(int x,int y){
    		    		    		int xRoot=find(x);
    		    		    		int yRoot=find(y);
    		    		    		
    		    		    		if(xRoot==yRoot)
    		    		    			return false;
    		    		    		if(rank[xRoot]<rank[yRoot]){
    		    		    		parent[xRoot]=yRoot;
    		    		    		str[yRoot]=Math.max(Math.max(str[xRoot], str[yRoot]), Math.max(x, y));
    		    		    		}else if(rank[yRoot]<rank[xRoot]){
    		    		    			parent[yRoot]=xRoot;
     
    			    		    		str[xRoot]=Math.max(Math.max(str[xRoot], str[yRoot]), Math.max(x, y));
    		    		    			
    		    		    		}else{
    		    		    			parent[yRoot]=xRoot;
    		    		    			rank[xRoot]++;
     
    			    		    		str[xRoot]=Math.max(Math.max(str[xRoot],str[yRoot]), Math.max(x, y));
    		    		    		}
    		    		    		return true;
    		    		    	}
    	
    		    		     
    		    		    }
 
 
							
 class Pair implements Comparable <Pair>{
											 long no_vert,no_edge;
											 Pair(long no_vert,long no_edge){
												 this.no_vert=no_vert;
												 this.no_edge=no_edge;
											 }
											 @Override
											 public int compareTo(Pair o){
												 return (int)(o.no_edge-no_edge);
											 }
											 
										 }
