import java.io.*;
import java.util.StringTokenizer;

public class MountainScenery {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskC solver = new TaskC();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskC {
        static final long MODULO = (long) (1e9 + 7);
        static int[] invs;
        static int[] facts;
        static int[] invfacts;

        static {
            int k = (int) 1e6;
            invs = new int[k + 2];
            invs[1] = 1;
            for (int i = 2; i <= k + 1; ++i) {
                invs[i] = (int) ((MODULO - (MODULO / i) * (long) invs[(int) (MODULO % i)] % MODULO) % MODULO);
            }
            facts = new int[k + 2];
            invfacts = new int[k + 2];
            facts[0] = 1;
            invfacts[0] = 1;
            for (int i = 1; i <= k + 1; ++i) {
                facts[i] = (int) (facts[i - 1] * (long) i % MODULO);
                invfacts[i] = (int) (invfacts[i - 1] * (long) invs[i] % MODULO);
            }
        }

        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int numPeaks = in.nextInt();
            int numPoints = numPeaks * 2 + 1;
            int k = in.nextInt();

            int[] altered = new int[numPoints];

            for (int i = 0; i < numPoints; i++) {
                altered[i] = in.nextInt();
            }

            int numFixed = 0;
            for (int i = 0; i < numPoints; i++) {
                if (i % 2 == 1) {
                    if (altered[i - 1] < altered[i] - 1 &&
                            altered[i + 1] < altered[i] - 1 && numFixed < k) {
                        out.print(altered[i] - 1 + " ");
                        numFixed++;
                    } else {
                        out.print(altered[i] + " ");
                    }
                } else {
                    out.print(altered[i] + " ");
                }
            }
        }
    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

    }
}


import java.io.*;
import java.util.StringTokenizer;

public class MountainScenery {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskC solver = new TaskC();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskC {
        static final long MODULO = (long) (1e9 + 7);
        static int[] invs;
        static int[] facts;
        static int[] invfacts;

        static {
            int k = (int) 1e6;
            invs = new int[k + 2];
            invs[1] = 1;
            for (int i = 2; i <= k + 1; ++i) {
                invs[i] = (int) ((MODULO - (MODULO / i) * (long) invs[(int) (MODULO % i)] % MODULO) % MODULO);
            }
            facts = new int[k + 2];
            invfacts = new int[k + 2];
            facts[0] = 1;
            invfacts[0] = 1;
            for (int i = 1; i <= k + 1; ++i) {
                facts[i] = (int) (facts[i - 1] * (long) i % MODULO);
                invfacts[i] = (int) (invfacts[i - 1] * (long) invs[i] % MODULO);
            }
        }

        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int numPeaks = in.nextInt();
            int numPoints = numPeaks * 2 + 1;
            int k = in.nextInt();

            int[] altered = new int[numPoints];

            for (int i = 0; i < numPoints; i++) {
                altered[i] = in.nextInt();
            }

            int numFixed = 0;
            for (int i = 0; i < numPoints; i++) {
                if (i % 2 == 0) {
                    if (altered[i - 1] < altered[i] - 1 &&
                            altered[i + 1] < altered[i] - 1 && numFixed < k) {
                        out.print(altered[i] - 1 + " ");
                        numFixed++;
                    } else {
                        out.print(altered[i] + " ");
                    }
                } else {
                    out.print(altered[i] + " ");
                }
            }
        }
    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

    }
}


import java.util.Scanner;
public class B {

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n=in.nextInt();
        int m=in.nextInt();
        int[]a=new int[n*2+1];
        for(int i=0;i<a.length;i++){
            a[i]=in.nextInt();
        }
        int count=0;
            for(int i=1;i<a.length;i+=2){
                if(a[i]-1!=a[i+1]&&a[i]!=a[i-1]){
                    a[i]=a[i]-1;
                    count++;
                }
                if(count==m)
                    break;
            }
        for(int i=0;i<a.length;i++){
            System.out.print(a[i]+" ");
        }

    }}


import java.util.Scanner;
public class B {

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n=in.nextInt();
        int m=in.nextInt();
        int[]a=new int[n*2+1];
        for(int i=0;i<a.length;i++){
            a[i]=in.nextInt();
        }
        int count=0;
            for(int i=1;i<a.length;i+=2){
                if(a[i]-1!=a[i+1]&&a[i]-1!=a[i-1]){
                    a[i]=a[i]-1;
                    count++;
                }
                if(count==m)
                    break;
            }
        for(int i=0;i<a.length;i++){
            System.out.print(a[i]+" ");
        }

    }}


import java.io.*;
import java.util.*;

public class A1008 {
    public static void main(String [] args) /*throws Exception*/ {
        InputStream inputReader = System.in;
        OutputStream outputReader = System.out;
        InputReader in = new InputReader(inputReader);//new InputReader(new FileInputStream(new File("input.txt")));new InputReader(inputReader);
        PrintWriter out = new PrintWriter(outputReader);//new PrintWriter(new FileOutputStream(new File("output.txt")));
        Algorithm solver = new Algorithm();
        solver.solve(in, out);
        out.close();
    }
}

class Algorithm {
    void solve(InputReader ir, PrintWriter pw) {

        int n = ir.nextInt(), k = ir.nextInt();
        int [] a = new int[2 * n + 1];

        for (int i = 0; i < 2 * n + 1; i++) a[i] = ir.nextInt();

        for (int i = 1; k > 0 && i < a.length; i += 2) {
            if (a[i] - 1 > a[i - 1] && a[i] - 1 > a[i + 1]) {
                a[i]--;
                k--;
            }
        }
        for (int i : a) pw.print(i + " ");

    }

}

class InputReader {
    private BufferedReader reader;
    private StringTokenizer tokenizer;

    InputReader(InputStream stream) {
        reader = new BufferedReader(new InputStreamReader(stream), 32768);
        tokenizer = null;
    }

    String next() {
        while (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {
                tokenizer = new StringTokenizer(reader.readLine());
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return tokenizer.nextToken();
    }

    String nextLine(){
        String fullLine = null;
        while (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {
                fullLine = reader.readLine();
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
            return fullLine;
        }
        return fullLine;
    }

    String [] toArray() {
        return nextLine().split(" ");
    }

    int nextInt() {
        return Integer.parseInt(next());
    }
    double nextDouble() {
        return Double.parseDouble(next());
    }
    long nextLong() {
        return Long.parseLong(next());
    }

}


import java.io.*;
import java.util.*;

public class A1008 {
    public static void main(String [] args) /*throws Exception*/ {
        InputStream inputReader = System.in;
        OutputStream outputReader = System.out;
        InputReader in = new InputReader(inputReader);//new InputReader(new FileInputStream(new File("input.txt")));new InputReader(inputReader);
        PrintWriter out = new PrintWriter(outputReader);//new PrintWriter(new FileOutputStream(new File("output.txt")));
        Algorithm solver = new Algorithm();
        solver.solve(in, out);
        out.close();
    }
}

class Algorithm {
    void solve(InputReader ir, PrintWriter pw) {

        int n = ir.nextInt(), k = ir.nextInt();
        int [] a = new int[2 * n + 1];
        for (int i = 1; k > 0 && i < a.length; i += 2) {
            if (a[i] - 1 > a[i - 1] && a[i] - 1 > a[i + 1]) {
                a[i]--;
                k--;
            }
        }
        for (int i : a) pw.print(i + " ");

    }

}

class InputReader {
    private BufferedReader reader;
    private StringTokenizer tokenizer;

    InputReader(InputStream stream) {
        reader = new BufferedReader(new InputStreamReader(stream), 32768);
        tokenizer = null;
    }

    String next() {
        while (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {
                tokenizer = new StringTokenizer(reader.readLine());
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return tokenizer.nextToken();
    }

    String nextLine(){
        String fullLine = null;
        while (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {
                fullLine = reader.readLine();
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
            return fullLine;
        }
        return fullLine;
    }

    String [] toArray() {
        return nextLine().split(" ");
    }

    int nextInt() {
        return Integer.parseInt(next());
    }
    double nextDouble() {
        return Double.parseDouble(next());
    }
    long nextLong() {
        return Long.parseLong(next());
    }

}


/**
 * Created by Khoi on 17/10/2017
 * For learning purpose
 */

import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.InputMismatchException;

public class main {
    InputStream is;
    PrintWriter out;
    String INPUT;

    void solve() {
        int n = ni();
        int k = ni();
        out.print(ni() + " ");
        for (int i = 0; i < n; i++) {
            if (k > 0) {
                out.print(ni() - 1 + " ");
                k -= 1;
            }
            else {
                out.print(ni() + " ");
            }
            out.print(ni() + " ");
        }
    }

    void run() throws Exception {
        is = oj ? System.in : new ByteArrayInputStream(INPUT.getBytes());
        out = new PrintWriter(System.out);

        long s = System.currentTimeMillis();
        solve();
        out.flush();
        tr(System.currentTimeMillis() - s + "ms");
    }

    public static void main(String[] args) throws Exception {
        new main().run();
    }

    private byte[] inbuf = new byte[1024];
    public int lenbuf = 0, ptrbuf = 0;

    private int readByte() {
        if (lenbuf == -1) throw new InputMismatchException();
        if (ptrbuf >= lenbuf) {
            ptrbuf = 0;
            try {
                lenbuf = is.read(inbuf);
            } catch (IOException e) {
                throw new InputMismatchException();
            }
            if (lenbuf <= 0) return -1;
        }
        return inbuf[ptrbuf++];
    }

    private boolean isSpaceChar(int c) {
        return !(c >= 33 && c <= 126);
    }

    private boolean isEndLine(int c) {
        return c < 32;
    }

    private int skip() {
        int b;
        while ((b = readByte()) != -1 && isSpaceChar(b)) ;
        return b;
    }

    private double nd() {
        return Double.parseDouble(ns());
    }

    private char nc() {
        return (char) skip();
    }

    private String nsl() {
        int b = skip();
        StringBuilder sb = new StringBuilder();
        while (!(isEndLine(b))) {
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }

    private String ns() {
        int b = skip();
        StringBuilder sb = new StringBuilder();
        while (!(isSpaceChar(b))) { // when nextLine, (isSpaceChar(b) && b != ' ')
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }

    private char[] ns(int n) {
        char[] buf = new char[n];
        int b = skip(), p = 0;
        while (p < n && !(isSpaceChar(b))) {
            buf[p++] = (char) b;
            b = readByte();
        }
        return n == p ? buf : Arrays.copyOf(buf, p);
    }

    private char[][] nm(int n, int m) {
        char[][] map = new char[n][];
        for (int i = 0; i < n; i++) map[i] = ns(m);
        return map;
    }

    private int[] na(int n) {
        int[] a = new int[n];
        for (int i = 0; i < n; i++) a[i] = ni();
        return a;
    }

    private int ni() {
        int num = 0, b;
        boolean minus = false;
        while ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-')) ;
        if (b == '-') {
            minus = true;
            b = readByte();
        }

        while (true) {
            if (b >= '0' && b <= '9') {
                num = num * 10 + (b - '0');
            } else {
                return minus ? -num : num;
            }
            b = readByte();
        }
    }

    private long nl() {
        long num = 0;
        int b;
        boolean minus = false;
        while ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-')) ;
        if (b == '-') {
            minus = true;
            b = readByte();
        }

        while (true) {
            if (b >= '0' && b <= '9') {
                num = num * 10 + (b - '0');
            } else {
                return minus ? -num : num;
            }
            b = readByte();
        }
    }

    // private boolean oj = System.getProperty("ONLINE_JUDGE") != null;
    private boolean oj = true;

    private void tr(Object... o) {
        if (!oj) System.out.println(Arrays.deepToString(o));
    }
}


/**
 * Created by Khoi on 16/10/2017
 * For learning purpose
 */

import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.BitSet;
import java.util.InputMismatchException;

public class main {
    InputStream is;
    PrintWriter out;
    String INPUT;

    void solve() {
        BitSet bset = BitSet.valueOf(new long[] {0b0111111});
        int n = ni();
        int idx1 = ni();
        ni(); ni();
        int bottom = 7 - idx1;
        int i1, i2;
        for (int i = 1; i < n; i++ ) {
            i1 = ni();
            i2 = ni();
            bset = BitSet.valueOf(new long[] {0b1111111});
            bset.flip(7 - bottom);
            bset.flip(i1);
            bset.flip(i2);
            bset.flip(7 - i1);
            bset.flip(7 - i2);
            bottom = bset.nextSetBit(1);
            if (bset.nextSetBit(bottom + 1) != -1) {
               out.println("NO");
               return;
            }
        }
        out.println("YES");
    }

    void run() throws Exception {
        is = oj ? System.in : new ByteArrayInputStream(INPUT.getBytes());
        out = new PrintWriter(System.out);

        long s = System.currentTimeMillis();
        solve();
        out.flush();
        tr(System.currentTimeMillis() - s + "ms");
    }

    public static void main(String[] args) throws Exception {
        new main().run();
    }

    private byte[] inbuf = new byte[1024];
    public int lenbuf = 0, ptrbuf = 0;

    private int readByte() {
        if (lenbuf == -1) throw new InputMismatchException();
        if (ptrbuf >= lenbuf) {
            ptrbuf = 0;
            try {
                lenbuf = is.read(inbuf);
            } catch (IOException e) {
                throw new InputMismatchException();
            }
            if (lenbuf <= 0) return -1;
        }
        return inbuf[ptrbuf++];
    }

    private boolean isSpaceChar(int c) {
        return !(c >= 33 && c <= 126);
    }

    private boolean isEndLine(int c) {
        return c < 32;
    }

    private int skip() {
        int b;
        while ((b = readByte()) != -1 && isSpaceChar(b)) ;
        return b;
    }

    private double nd() {
        return Double.parseDouble(ns());
    }

    private char nc() {
        return (char) skip();
    }

    private String nsl() {
        int b = skip();
        StringBuilder sb = new StringBuilder();
        while (!(isEndLine(b))) {
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }

    private String ns() {
        int b = skip();
        StringBuilder sb = new StringBuilder();
        while (!(isSpaceChar(b))) { // when nextLine, (isSpaceChar(b) && b != ' ')
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }

    private char[] ns(int n) {
        char[] buf = new char[n];
        int b = skip(), p = 0;
        while (p < n && !(isSpaceChar(b))) {
            buf[p++] = (char) b;
            b = readByte();
        }
        return n == p ? buf : Arrays.copyOf(buf, p);
    }

    private char[][] nm(int n, int m) {
        char[][] map = new char[n][];
        for (int i = 0; i < n; i++) map[i] = ns(m);
        return map;
    }

    private int[] na(int n) {
        int[] a = new int[n];
        for (int i = 0; i < n; i++) a[i] = ni();
        return a;
    }

    private int ni() {
        int num = 0, b;
        boolean minus = false;
        while ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-')) ;
        if (b == '-') {
            minus = true;
            b = readByte();
        }

        while (true) {
            if (b >= '0' && b <= '9') {
                num = num * 10 + (b - '0');
            } else {
                return minus ? -num : num;
            }
            b = readByte();
        }
    }

    private long nl() {
        long num = 0;
        int b;
        boolean minus = false;
        while ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-')) ;
        if (b == '-') {
            minus = true;
            b = readByte();
        }

        while (true) {
            if (b >= '0' && b <= '9') {
                num = num * 10 + (b - '0');
            } else {
                return minus ? -num : num;
            }
            b = readByte();
        }
    }

    // private boolean oj = System.getProperty("ONLINE_JUDGE") != null;
    private boolean oj = true;

    private void tr(Object... o) {
        if (!oj) System.out.println(Arrays.deepToString(o));
    }
}


/**
 * Created by Khoi on 17/10/2017
 * For learning purpose
 */

import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.InputMismatchException;

public class main {
    InputStream is;
    PrintWriter out;
    String INPUT;

    void solve() {
        int n = ni();
        int k = ni();
        int[] arr = new int[n *2 + 1];
        for (int i = 0; i < arr.length; i++)
            arr[i] = ni();

        for (int i = 0; i < arr.length; i++) {
            if (i % 2 == 1 && k > 0 && arr[i] > arr[i-1] + 1 && arr[i] > arr[i+1] + 1) {
                out.print(arr[i] - 1 + " ");
                k -= 1;
            }
            else {
                out.print(arr[i] + " ");
            }
        }
    }

    void run() throws Exception {
        is = oj ? System.in : new ByteArrayInputStream(INPUT.getBytes());
        out = new PrintWriter(System.out);

        long s = System.currentTimeMillis();
        solve();
        out.flush();
        tr(System.currentTimeMillis() - s + "ms");
    }

    public static void main(String[] args) throws Exception {
        new main().run();
    }

    private byte[] inbuf = new byte[1024];
    public int lenbuf = 0, ptrbuf = 0;

    private int readByte() {
        if (lenbuf == -1) throw new InputMismatchException();
        if (ptrbuf >= lenbuf) {
            ptrbuf = 0;
            try {
                lenbuf = is.read(inbuf);
            } catch (IOException e) {
                throw new InputMismatchException();
            }
            if (lenbuf <= 0) return -1;
        }
        return inbuf[ptrbuf++];
    }

    private boolean isSpaceChar(int c) {
        return !(c >= 33 && c <= 126);
    }

    private boolean isEndLine(int c) {
        return c < 32;
    }

    private int skip() {
        int b;
        while ((b = readByte()) != -1 && isSpaceChar(b)) ;
        return b;
    }

    private double nd() {
        return Double.parseDouble(ns());
    }

    private char nc() {
        return (char) skip();
    }

    private String nsl() {
        int b = skip();
        StringBuilder sb = new StringBuilder();
        while (!(isEndLine(b))) {
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }

    private String ns() {
        int b = skip();
        StringBuilder sb = new StringBuilder();
        while (!(isSpaceChar(b))) { // when nextLine, (isSpaceChar(b) && b != ' ')
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }

    private char[] ns(int n) {
        char[] buf = new char[n];
        int b = skip(), p = 0;
        while (p < n && !(isSpaceChar(b))) {
            buf[p++] = (char) b;
            b = readByte();
        }
        return n == p ? buf : Arrays.copyOf(buf, p);
    }

    private char[][] nm(int n, int m) {
        char[][] map = new char[n][];
        for (int i = 0; i < n; i++) map[i] = ns(m);
        return map;
    }

    private int[] na(int n) {
        int[] a = new int[n];
        for (int i = 0; i < n; i++) a[i] = ni();
        return a;
    }

    private int ni() {
        int num = 0, b;
        boolean minus = false;
        while ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-')) ;
        if (b == '-') {
            minus = true;
            b = readByte();
        }

        while (true) {
            if (b >= '0' && b <= '9') {
                num = num * 10 + (b - '0');
            } else {
                return minus ? -num : num;
            }
            b = readByte();
        }
    }

    private long nl() {
        long num = 0;
        int b;
        boolean minus = false;
        while ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-')) ;
        if (b == '-') {
            minus = true;
            b = readByte();
        }

        while (true) {
            if (b >= '0' && b <= '9') {
                num = num * 10 + (b - '0');
            } else {
                return minus ? -num : num;
            }
            b = readByte();
        }
    }

    // private boolean oj = System.getProperty("ONLINE_JUDGE") != null;
    private boolean oj = true;

    private void tr(Object... o) {
        if (!oj) System.out.println(Arrays.deepToString(o));
    }
}


import java.util.Scanner;

public class Mountain {

    public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int n=in.nextInt();
int k=in.nextInt();
int count =0;
 n=2*n+1;
int[] a = new int[n+1];

for(int i=0;i<n;i++)
a[i]=in.nextInt();

for (int i=0 ;i<n;i++){
if (count <k){
if(i%2!=0&&i>=2&&a[i]>a[i+1]+1&&a[i]>a[i-1]+1){
a[i]=a[i]-1;
++count;
//    System.out.println(count);
}

}

}
for(int i =0 ;i<n;i++)
        System.out.print(a[i] +" ");

    }

}


import java.util.Scanner;

public class Mountain {

    public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int n=in.nextInt();
int k=in.nextInt();
int count =0;
 n=2*n+1;
int[] a = new int[n+1];

for(int i=0;i<n;i++)
a[i]=in.nextInt();

for (int i=0 ;i<n;i++){
if (count <k){
if(i%2!=0&&i>=1&&a[i]>a[i+1]+1&&a[i]>a[i-1]+1){
a[i]=a[i]-1;
++count;
//    System.out.println(count);
}

}

}
for(int i =0 ;i<n;i++)
        System.out.print(a[i] +" ");

    }

}


import java.util.Scanner;

public class MountainScenery_218A {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int n = in.nextInt();
		int k = in.nextInt();
		for (int i = 1 ; i <= 2*n+1 ; i++)
		{
			int r = in.nextInt();
			if ( k>0 && i%2 == 0 && r>0 )
			{
				System.out.print(--r +" ");
				k--;
			}else{
				System.out.print(r +" ");
			}
		}
	}
}


import java.util.Scanner;

public class MountainScenery_218A {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int n = in.nextInt();
		int k = in.nextInt();
		int [] r = new int [2*n+2];
		for (int i = 1 ; i <= 2*n+1 ; i++)
		{
			r[i] = in.nextInt();
		}
		for (int i = 1 ; i <= 2*n+1 ; i++)
		{
			if ( k>0 && i%2 == 0 && r[i]>0 && (r[i] -1 ) > r[i-1] && (r[i] - 1 ) > r[i+1])
			{
				System.out.print(--r[i] +" ");
				k--;
			}else{
				System.out.print(r[i] +" ");
			}
		}
	}
}


import java.util.Scanner;

public class MainScreen {

    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        int n = input.nextInt();
        int k = input.nextInt();
        int array [] = new int [2*n+1];
        int times=0;

        for ( int x = 0; x < 2*n+1;x++) {

            array [x] = input.nextInt();
        }
        for ( int x = 2; x < 2*n;x++) {
        	if (array [x] >array [x-1]&&array [x] >array [x-1]&&times<=k) {
        		array [x]--;
        		times++;
        	}
        	if (times ==k) {
        		break;
        	}
        }

         for ( int x = 0; x < 2*n+1;x++) {
        	System.out.print(array [x]+ " ");
        }

    }

}


import java.util.Scanner;

public class MainScreen {

    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        int n = input.nextInt();
        int k = input.nextInt();
        int array [] = new int [2*n+1];
        int times=0;

        for ( int x = 0; x < 2*n+1;x++) {

            array [x] = input.nextInt();
        }
        for ( int x = 1; x < 2*n;x++) {
        	if (array [x] -1>array [x-1]&&array [x]-1 >array [x-1]&&times<=k) {
        		array [x]--;
        		times++;
        	}
        	if (times ==k) {
        		break;
        	}
        }

         for ( int x = 0; x < 2*n+1;x++) {
        	System.out.print(array [x]+ " ");
        }

    }

}


import java.util.Scanner;

public class MainScreen {

    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        int n = input.nextInt();
        int k = input.nextInt();
        int array [] = new int [2*n+1];
        int times=0;

        for ( int x = 0; x < 2*n+1;x++) {

            array [x] = input.nextInt();
        }
        for ( int x = 1; x < 2*n;x++) {
        	if (array [x]-1>array [x+1]&&array [x]-1 >array [x-1]&&times<=k) {
        		array [x]--;
        		times++;
        	}
        	if (times ==k) {
        		break;
        	}
        }

         for ( int x = 0; x < 2*n+1;x++) {
        	System.out.print(array [x]+ " ");
        }

    }

}


import java.util.Scanner;

public class MainScreen {

    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        int n = input.nextInt();
        int k = input.nextInt();
        int array [] = new int [2*n+1];
        int times=0;

        for ( int x = 0; x < 2*n+1;x++) {

            array [x] = input.nextInt();
        }
        for ( int x = 1; x < 2*n;x++) {
        	if (array [x] >array [x-1]&&array [x] >array [x-1]&&times<=k) {
        		array [x]--;
        		times++;
        	}
        	if (times ==k) {
        		break;
        	}
        }

         for ( int x = 0; x < 2*n+1;x++) {
        	System.out.print(array [x]+ " ");
        }

    }

}


import java.util.Scanner;

public class main {

    public static  void main(String[] args){
        int peaks, chosen,x=0;

        Scanner input = new Scanner(System.in);

        peaks = input.nextInt();
        chosen = input.nextInt();

        int[] y = new int[2*peaks+1];

        for (int i = 0; i<y.length; i++)
            y[i] = input.nextInt();

        for (int i=1; i<y.length; i=i+2){
            if (x == chosen)
                break;
            if (y[i]==1)
                continue;
            else
            {
                y[i]--;
                x++;
            }

        }
        for (int i=0; i<y.length; i++){
            System.out.println(y[i]);
        }

    }
}


import java.util.Scanner;

public class main {

    public static  void main(String[] args){
        int peaks, chosen,x=0;

        Scanner input = new Scanner(System.in);

        peaks = input.nextInt();
        chosen = input.nextInt();

        int[] y = new int[2*peaks+1];

        for (int i = 0; i<y.length; i++)
            y[i] = input.nextInt();

        for (int i=1; i<y.length; i=i+2){
            if (x == chosen)
                break;
            else
            {
                y[i]--;
                x++;
            }

        }
        for (int i=0; i<y.length; i++){
            System.out.println(y[i]);
        }

    }
}


import java.util.Scanner;

public class main {

    public static  void main(String[] args){
        int peaks, chosen,x=0;

        Scanner input = new Scanner(System.in);

        peaks = input.nextInt();
        chosen = input.nextInt();

        int[] y = new int[2*peaks+1];

        for (int i = 0; i<y.length; i++)
            y[i] = input.nextInt();

        for (int i=1; i<y.length; i=i+2){
            if (x == chosen)
                break;
            if (y[i]==1 || y[i]==y[i-1]+1 || y[i]==y[i+1])
                continue;
            else
            {
                y[i]--;
                x++;
            }

        }
        for (int i=0; i<y.length; i++){
            System.out.println(y[i]);
        }

    }
}


import java.util.Scanner;

public class main {

    public static  void main(String[] args){
        int peaks, chosen,x=0;

        Scanner input = new Scanner(System.in);

        peaks = input.nextInt();
        chosen = input.nextInt();

        int[] y = new int[2*peaks+1];

        for (int i = 0; i<y.length; i++)
            y[i] = input.nextInt();

        for (int i=1; i<y.length; i=i+2){
            if (x == chosen)
                break;
            if (y[i]==1 || y[i]==y[i-1]+1)
                continue;
            else
            {
                y[i]--;
                x++;
            }

        }
        for (int i=0; i<y.length; i++){
            System.out.println(y[i]);
        }

    }
}


import java.util.Scanner;

public class main {

    public static  void main(String[] args){
        int peaks, chosen,x=0;

        Scanner input = new Scanner(System.in);

        peaks = input.nextInt();
        chosen = input.nextInt();

        int[] y = new int[2*peaks+1];

        for (int i = 0; i<y.length; i++)
            y[i] = input.nextInt();

        for (int i=1; i<y.length; i=i+2){
            if (x == chosen)
                break;
            if (y[i]==1 || y[i]==y[i-1]+1 || y[i]==y[i+1]+1)
                continue;
            else
            {
                y[i]--;
                x++;
            }

        }
        for (int i=0; i<y.length; i++){
            System.out.println(y[i]);
        }

    }
}


import java.util.*;
import java.lang.*;
import java.io.*;

/* Name of the class has to be "Main" only if the class is public. */
public class Codechef
{
	public static void main (String[] args) throws java.lang.Exception
	{
	     Scanner SC=new Scanner(System.in);
	     BufferedReader br=new BufferedReader(new InputStreamReader(System.in));

		int n=0;
		int k=0;

		if(SC.hasNext())
		n=SC.nextInt();

		if(SC.hasNext())
		k=SC.nextInt();

		int arr[]=new int[((2*n)+1)];

		for(int i=0;i<((2*n)+1);i++)
		{
		     arr[i]=SC.nextInt();

		}
		/*if(k<=n)
		{
		     int temp=0;

     		for(int i=0;i<arr.length;i+=2)
     		{
     		    if(temp<k)
     		    {arr[i]=arr[i]-1;
     		    temp++;}
     		    else
     		    break;
     		}
		}
		else*/
		{
		     int temp=0;

     		for(int i=1;i<arr.length;i+=2)
     		{

     		    if(temp<k)
     		    {
     		         if((arr[i]-1)>arr[i+1]&&(arr[i]-1)>arr[i-1])
     		         {arr[i]=arr[i]-1;
     		         temp++;}
     		    }
     		}
		}

		for(int i=0;i<arr.length;i++)
		{
		     System.out.print(arr[i]+" ");
		}

     }

     /*boolean Checkgood(long n,int k)
     {
          boolean arr[]=new boolean[k+1];

          for(int i=0;i<=k;i++)
          {    arr[i]=false;  }

          while(n>0)
          {
               int temp=(int)n%10;
               if(temp<=k)
               arr[temp]=true;
               n/=10;
          }
          for(int i=0;i<=k;i++)
          {
               if(arr[i]==false)
               return false;
          }
          return true;
     }
     */
}


import java.util.*;
import java.lang.*;
import java.io.*;

/* Name of the class has to be "Main" only if the class is public. */
public class Codechef
{
	public static void main (String[] args) throws java.lang.Exception
	{
	     Scanner SC=new Scanner(System.in);
	     BufferedReader br=new BufferedReader(new InputStreamReader(System.in));

		int n=0;
		int k=0;

		if(SC.hasNext())
		n=SC.nextInt();

		if(SC.hasNext())
		k=SC.nextInt();

		int arr[]=new int[((2*n)+1)];

		for(int i=0;i<((2*n)+1);i++)
		{
		     arr[i]=SC.nextInt();

		}
		/*if(k<=n)
		{
		     int temp=0;

     		for(int i=0;i<arr.length;i+=2)
     		{
     		    if(temp<k)
     		    {arr[i]=arr[i]-1;
     		    temp++;}
     		    else
     		    break;
     		}
		}
		else*/
		{
		     int temp=0;

     		for(int i=1;i<arr.length;i+=2)
     		{

     		    if(temp<k)
     		    {
     		         if((arr[i]-1)>arr[i+1]&&(arr[i]-1)>arr[i-1])
     		         arr[i]=arr[i]-1;
     		         temp++;
     		    }
     		}
		}

		for(int i=0;i<arr.length;i++)
		{
		     System.out.print(arr[i]+" ");
		}

     }

     /*boolean Checkgood(long n,int k)
     {
          boolean arr[]=new boolean[k+1];

          for(int i=0;i<=k;i++)
          {    arr[i]=false;  }

          while(n>0)
          {
               int temp=(int)n%10;
               if(temp<=k)
               arr[temp]=true;
               n/=10;
          }
          for(int i=0;i<=k;i++)
          {
               if(arr[i]==false)
               return false;
          }
          return true;
     }
     */
}


import java.util.*;
import java.lang.*;
import java.io.*;

/* Name of the class has to be "Main" only if the class is public. */
public class Codechef
{
	public static void main (String[] args) throws java.lang.Exception
	{
	     Scanner SC=new Scanner(System.in);
	     BufferedReader br=new BufferedReader(new InputStreamReader(System.in));

		int n=0;
		int k=0;

		if(SC.hasNext())
		n=SC.nextInt();

		if(SC.hasNext())
		k=SC.nextInt();

		int arr[]=new int[((2*n)+1)];

		for(int i=0;i<((2*n)+1);i++)
		{
		     arr[i]=SC.nextInt();

		}
		/*if(k<=n)
		{
		     int temp=0;

     		for(int i=0;i<arr.length;i+=2)
     		{
     		    if(temp<k)
     		    {arr[i]=arr[i]-1;
     		    temp++;}
     		    else
     		    break;
     		}
		}
		else*/
		{
		     int temp=0;

     		for(int i=1;i<arr.length;i+=2)
     		{

     		    if(temp<k)
     		    {
     		         if((arr[i]-1)<arr[i+1]&&(arr[i]-1)<arr[i-1])
     		         arr[i]=arr[i]-1;
     		         temp++;
     		    }
     		}
		}

		for(int i=0;i<arr.length;i++)
		{
		     System.out.print(arr[i]+" ");
		}

     }

     /*boolean Checkgood(long n,int k)
     {
          boolean arr[]=new boolean[k+1];

          for(int i=0;i<=k;i++)
          {    arr[i]=false;  }

          while(n>0)
          {
               int temp=(int)n%10;
               if(temp<=k)
               arr[temp]=true;
               n/=10;
          }
          for(int i=0;i<=k;i++)
          {
               if(arr[i]==false)
               return false;
          }
          return true;
     }
     */
}


import java.util.Scanner;
public class Main {

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        int k = in.nextInt();
        int []array = new int [2*n + 1] ;
        for (int i = 0 ; i < 2*n +1 ; i ++) {
            array[i] = in.nextInt();
        }
        for (int i = 1 ; i < 2*n +1 && k > 0  ; i ++ ){
            if ((i+1) % 2 == 0 && (array[i] -1 ) > array[i-1] && (array[i] -1 ) > array[i+1]){
                k-- ;
                array[i] = array[i] - 1 ;
            }

        }
        for (int i = 0 ; i < array.length ; i ++) {
            System.out.print(array[i] + " ");
        }

    }

}


import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.io.OutputStream;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;
import java.io.BufferedOutputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Kattio in = new Kattio(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskA solver = new TaskA();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskA {
        public void solve(int testNumber, Kattio in, PrintWriter out) {
            int n = in.nextInt();
            int k = in.nextInt();

            int[] arr = new int[2 * n + 2];

            for (int i = 1; i <= 2 * n + 1; ++i)
                arr[i] = in.nextInt();

            for (int i = 2; i <= 2 * n && k > 0; i += 2) {
                if (arr[i] > arr[i - 1] + 1 && arr[i] > arr[i + 1] + 1) {
                    --arr[i];
                    --k;
                }
            }

            for (int i = 1; i <= 2 * n + 1; ++i)
                out.print(arr[i] + " ");

        }

    }

    static class Kattio extends PrintWriter {
        private BufferedReader r;
        private String line;
        private StringTokenizer st;
        private String token;

        public Kattio(InputStream i) {
            super(new BufferedOutputStream(System.out));
            r = new BufferedReader(new InputStreamReader(i));
        }

        public Kattio(InputStream i, OutputStream o) {
            super(new BufferedOutputStream(o));
            r = new BufferedReader(new InputStreamReader(i));
        }

        public int nextInt() {
            return Integer.parseInt(nextToken());
        }

        private String peekToken() {
            if (token == null)
                try {
                    while (st == null || !st.hasMoreTokens()) {
                        line = r.readLine();
                        if (line == null) return null;
                        st = new StringTokenizer(line);
                    }
                    token = st.nextToken();
                } catch (IOException e) {
                }
            return token;
        }

        private String nextToken() {
            String ans = peekToken();
            token = null;
            return ans;
        }

    }
}


import java.io.*;

public class MountainScenery {
    public static void main(String[] args) throws IOException{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String[] input = br.readLine().split("\\s+");
        String[] peaks = br.readLine().split("\\s+");
        for(int i=1; i<= Integer.parseInt(input[1])*2; i+=2)
            peaks[i] = String.valueOf(Integer.parseInt(peaks[i])-1);
        for(int i=0; i<peaks.length; i++)
            System.out.print(peaks[i]+" ");
    }
}


import java.io.*;

public class MountainScenery {
    public static void main(String[] args) throws IOException{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String[] input = br.readLine().split("\\s+");
        String[] peaks = br.readLine().split("\\s+");
        for(int i=1; i<= Integer.parseInt(input[1]); i+=2)
            peaks[i] = String.valueOf(Integer.parseInt(peaks[i])-1);
        for(int i=0; i<peaks.length; i++)
            System.out.print(peaks[i]+" ");
    }
}


import java.io.*;

public class MountainScenery {
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String[] input = br.readLine().split("\\s+");
        String[] peaks = br.readLine().split("\\s+");
        int[] y = new int[peaks.length];
        for (int i = 0; i < peaks.length; i++)
            y[i] = Integer.parseInt(peaks[i]);
        int counter = Integer.parseInt(input[1]);
        for (int i = 1; i < peaks.length && counter > 0; i += 2) {
            if (y[i - 1] < (y[i] - 1) && y[i + 1] < (y[i] - 1)) {
                y[i]--;
                counter--;
            }
        }
        for (int i = 0; i < y.length; i++)
            System.out.print(y[i] + " ");
    }
}


import java.util.*;

public class Dcoder
{
	public static void main(String args[])
	{
		Scanner input =new Scanner(System.in);

		int n =input.nextInt();
		int k =input.nextInt();
		int x =0;
		int y =0;
		int z =input.nextInt();
		for(int i =3;i<=2*n+1;i +=2){
			x=z;
			System.out.print(x+" ");
			y=input.nextInt();
			z=input.nextInt();
			if(k!=0 && x<y-1 && z<y-1){
				k--;
				y--;
			}
			System.out.print(y+" ");
		}
		System.out.print(z);

	}
 }


import java.util.*;

public class Dcoder
{
	public static void main(String args[])
	{
		Scanner input =new Scanner(System.in);

		int n =input.nextInt();
		int k =input.nextInt();
		int [] a =new int [2*n+1];

		for(int i =0;i<2*n+1;i++){
			a[i]=input.nextInt();
			if(k!=0 && i!=0 && i%2==0){

			}
		}
		for(int i =1;i<2*n+1 ;i +=2){
			System.out.print(a[i-1]+" ");
			if(k>0 && a[i-1]<a[i]-1 && a[i+1]<a[i]-1){
				a[i]--;
				k--;
			}
			System.out.print(a[i]+" ");
		}
		System.out.print(a[2*n]);

	}
 }


//package A218;

/**
 *
 * @author Abdulrahman Mobarak
 */
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

public class Main {

    public static void main(String[] args) throws IOException {
        InputReader in = new InputReader(System.in);
        PrintWriter out = new PrintWriter(System.out);
        TaskA solver = new TaskA();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskA {

        public void solve(int testNumber, InputReader input, PrintWriter out) throws IOException {
            int n, k;
            n = input.nextInt();
            k = input.nextInt();
            int arr[] = new int[2 * n + 2];
            for (int i = 1; i < arr.length; i++) {
                arr[i] = input.nextInt();
            }
            int count = 0;
            for (int i = 2; i < arr.length; i += 2) {
                if (count == k) {
                    break;
                }
                if (arr[i] - 1 > arr[i - 1] && arr[i] - 1 > arr[i + 1]) {
                    arr[i] = arr[i] - 1;
                    count++;
                }
            }
            if (count == k) {
                for (int i = 1; i < arr.length; i++) {
                    out.print(arr[i]+" ");
                }
                out.println();
            } else {
                for (int i = 1; i < arr.length; i += 2) {
                    if (count == k || i+1 == arr.length) {
                        break;
                    }
                    if (arr[i] >= arr[i + 1]) {
                        arr[i] -= arr[i + 1] + 1;
                        count++;
                    }
                }
                for (int i = 1; i < arr.length; i++) {
                    out.print(arr[i]+" ");
                }
                out.println();
            }
        }

    }

    static class InputReader {

        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

        public long nextLong() {
            return Long.parseLong(next());
        }
    }
}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class MountainScenery {

    public static void main(String[] args) {
        FastReader reader = new FastReader();

        int n = reader.nextInt();
        int k = reader.nextInt();
        int size = 2*n+1;
        int[] segment = new int[size];
        for (int i = 0; i < size; i++) {
            segment[i] = reader.nextInt();
        }

        for (int i = 1; i < size; i+=2) {
            int current = segment[i];
            int previous = segment[i-1];
            int next = segment[i+1];
            if (current-1 > previous && current-1 > next) {
                segment[i] -= 1;
                k--;
            }
            if (k == 0) break;
        }
        for (int i = 0; i < size; i++) {
            System.out.print(segment[i] + " ");
        }
        System.out.println();
    }

    static class FastReader {
        BufferedReader br;
        StringTokenizer st;

        public FastReader() {
            br = new BufferedReader(new
                    InputStreamReader(System.in));
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                }
                catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }

        String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            }
            catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }
    }
}


import javafx.util.Pair;

import java.io.*;
import java.util.*;

public class Main {

    public static void main(String[] args) throws IOException {
        Scanner sc = new Scanner(System.in);
        PrintWriter out = new PrintWriter(System.out);
        ////////////////////////////////////////////////////////////////////////
        int n, k;
        n = sc.nextInt();
        n = 2*n+1;
        k = sc.nextInt();
        Integer arr[] = new Integer[n];

        for (int i = 0; i < n; i++) {
            arr[i] = sc.nextInt();
        }
        for (int i = 1; i < n && k > 0; i += 2) {
            if (arr[i] - arr[i - 1] >= 2 && arr[i] - arr[i + 1] >= 2) {
                arr[i]--;
                k--;
            }
        }
        for (int i = 0; i < n; i++) {
            out.print(arr[i]+" ");
        }

        ////////////////////////////////////////////////////////////////////////
        out.flush();
        out.close();
    }

    static class Scanner {
        StringTokenizer st;
        BufferedReader br;

        public Scanner(InputStream s) {
            br = new BufferedReader(new InputStreamReader(s));
        }

        public String next() throws IOException {
            while (st == null || !st.hasMoreTokens())
                st = new StringTokenizer(br.readLine());
            return st.nextToken();
        }

        public int nextInt() throws IOException {
            return Integer.parseInt(next());
        }

        public long nextLong() throws IOException {
            return Long.parseLong(next());
        }

        public String nextLine() throws IOException {
            return br.readLine();
        }

        public double nextDouble() throws IOException {
            String x = next();
            StringBuilder sb = new StringBuilder("0");
            double res = 0, f = 1;
            boolean dec = false, neg = false;
            int start = 0;
            if (x.charAt(0) == '-') {
                neg = true;
                start++;
            }
            for (int i = start; i < x.length(); i++)
                if (x.charAt(i) == '.') {
                    res = Long.parseLong(sb.toString());
                    sb = new StringBuilder("0");
                    dec = true;
                } else {
                    sb.append(x.charAt(i));
                    if (dec)
                        f *= 10;
                }
            res += Long.parseLong(sb.toString()) / f;
            return res * (neg ? -1 : 1);
        }

        public boolean ready() throws IOException {
            return br.ready();
        }

    }
}


import java.util.ArrayList;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner s = new Scanner(System.in);
        int n = s.nextInt();
        int k = s.nextInt();
        ArrayList<Integer> points = new ArrayList<>();
        for(int i=0;i<2*n+1;i++){
            points.add(s.nextInt());
        }
        getOriginalPoints(points,k);
    }

    private static void getOriginalPoints(ArrayList<Integer> points, int k) {
        for(int i=1;i<points.size()-1;i+=2){
            if(k==0){
                break;
            }
            if(points.get(i)-1>points.get(i-1)&&points.get(i)-1>points.get(i+1)){
                points.set(i,points.get(i)-1);
                --k;
            }
        }
        for(int i=0;i<points.size();i++){
            System.out.print(points.get(i)+" ");
        }
    }
}


import java.util.*;
import java.io.*;

public class Main {

	public static void main(String[] args) {
		Scanner in  = new Scanner(new BufferedReader(new InputStreamReader((System.in))));
		int n = in.nextInt(), k = in.nextInt();
		int[] arr = new int[2*n + 1];
		for(int i = 0; i <= 2*n; i++) {
			arr[i] = in.nextInt();
		}
		for(int x = 0; x < n; x++) {
			System.out.print(arr[2*x] + " ");
			if(arr[2*x + 1] > arr[2*x] + 1 && arr[2*x + 1] > arr[2*x + 2] + 1 && k-- > 0)
				System.out.print(arr[2*x + 1] - 1 + " ");
			else
				System.out.print(arr[2*x + 1] + " ");
		}
		System.out.print(arr[2*n] + " ");
	}

}


import java.util.*;
import java.io.*;

public class Main {

	public static void main(String[] args) {
		Scanner in  = new Scanner(new BufferedReader(new InputStreamReader((System.in))));
		int n = in.nextInt(), k = in.nextInt();
		for(int i = 0; i < n; i++) {
			System.out.print(in.nextInt() + " ");
			if(k-- > 0) {
				System.out.print(in.nextInt() - 1 + " ");
			}
			else
				System.out.print(in.nextInt() + " ");
		}
		System.out.print(in.nextInt() + " ");
	}

}


import java.util.*;
import java.io.*;

public class Main {

	public static void main(String[] args) {
		Scanner in  = new Scanner(new BufferedReader(new InputStreamReader((System.in))));
		int n = in.nextInt(), k = in.nextInt();
		int[] arr = new int[2*n + 1];
		for(int i = 0; i <= 2*n; i++) {
			arr[i] = in.nextInt();
		}
		for(int x = 0; x < n; x++) {
			System.out.print(arr[2*x] + " ");
			if(arr[2*x + 1] > arr[2*x] + 1 && arr[2*x + 1] > arr[2*x + 2] + 1 && k-- > 0)
				System.out.print(arr[2*x + 1] - 1 + " ");
			else
				System.out.print(arr[2*x + 1] + " ");
		}

	}

}


import java.util.Scanner;

public class MountinSce {

	public static void main(String[] args) {
		Scanner input = new Scanner(System.in) ;
		int n = input.nextInt() ;
		int k = input.nextInt() ;
		int size = 2 * n + 1 ;
		int a [] = new int[size] ;
		for(int i = 0 ; i < size ; i++){
			a[i] = input.nextInt() ;
		}
		input.close();
		for(int i = 1 ; k != 0 ; i+= 2){
			if(a[i] > 0 && a[i] - a[i - 1] > 1 && a[i] - a[i + 1] > 1 ){
				a[i] -- ;
				k -- ;
			}
		}
		for(int i = 0 ; i < size ; i++){
			System.out.print(a[i] + " ");
		}
	}

}


import java.util.Scanner;

public class MountinSce {

	public static void main(String[] args) {
		Scanner input = new Scanner(System.in) ;
		int n = input.nextInt() ;
		int k = input.nextInt() ;
		int size = 2 * n + 1 ;
		int a [] = new int[size] ;
		for(int i = 0 ; i < size ; i++){
			a[i] = input.nextInt() ;
		}
		input.close();
		for(int i = 1 ; k != 0 ; i+= 2){
			if(a[i] > 0){
				a[i] -- ;
				k -- ;
			}
		}
		for(int i = 0 ; i < size ; i++){
			System.out.print(a[i] + " ");
		}
	}

}


import java.io.*;
import java.util.*;

/*
* @author: Ramanqul
* */
public class Main {
    private static boolean USE_TEST_CASES = false;

    private static int sample(int n, int m, PrintWriter out) {
        int ans = 0;
        for (int i=1;i<=n;i++) {
            for (int j=1;j<=m;j++) {
                if ((i+j) % 5 == 0) {
                    ans++;
                    out.printf("(%d %d) ", i, j);
                }
            }
            out.println();
        }
        out.println();
        return ans;
    }

    private static void solve(MyScanner in, PrintWriter out) {
        int n = in.nextInt();
        int k = in.nextInt();

        int a[] = new int[2*n+1];
        H.readArray(in, a, a.length);

        for (int i=1;i<a.length && k > 0;i++) {
            if (i % 2 != 0 && a[i]-1 > a[i-1] && a[i]-1 > a[i+1]) {
                a[i]--;
                k--;
            }
        }

        for (int i=0;i<a.length;i++) {
            out.print(a[i] + " ");
        }
        out.println();
    }

    public static void main(String[] args) {
        MyScanner sc = new MyScanner();
        PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out));
        int t = 1;

        if (USE_TEST_CASES) {
            t = sc.nextInt();
        }

        for (int i=0;i<t;i++) {
            solve(sc, out);
        }
        out.close();
    }

    private static class Pair<A,B> {
        public A first;
        public B second;
        public Pair(A first, B second) {
            this.first = first;
            this.second = second;
        }
    }

    private static class Triple<A,B,C> {
        public A first;
        public B second;
        public C third;

        public Triple(A first, B second, C third) {
            this.first = first;
            this.second = second;
            this.third = third;
        }
    }

    private static class H {
        public static void readArray(MyScanner in, int a[], int n) {
            for (int i=0;i<n;i++) {
                a[i] = in.nextInt();
            }
        }

        public static Pair<Integer, Integer>[] readIntPairs(MyScanner in, int n) {
            Pair[] pairs = new Pair[n];
            for (int i=0;i<n;i++) {
                int x = in.nextInt();
                int y = in.nextInt();
                pairs[i] = new Pair<Integer, Integer>(x, y);
            }

            return pairs;
        }

        public static List<Integer> dfs(int start, List<Integer>[] adj) {
            boolean v[] = new boolean[adj.length+1];

            List<Integer> res = new ArrayList<>();

            Stack<Integer> st = new Stack<>();

            st.push(start);

            while (!st.isEmpty()) {
                int x = st.pop();
                if (!v[x]) {
                    res.add(x);
                    boolean allVisited = true;
                    for (int e: adj[x]) {
                        if (!v[e]) {
                            st.push(e);
                            allVisited = false;
                        }
                    }

                    if (allVisited) {
                        break;
                    }

                    v[x] = true;
                } else {
                    break;
                }
            }

            return res;
        }

        public static long gcd(long a, long b) {
            if (a == 0) {
                return b;
            }

            return gcd(b%a, a);
        }

        public static long lcm(long a, long b) {
            return (a * b) / gcd(a,b);
        }
    }

    private static class MyScanner {
        BufferedReader br;
        StringTokenizer st;

        public MyScanner() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }
        public MyScanner(InputStream is) {
            br = new BufferedReader(new InputStreamReader(is));
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }

        String nextLine(){
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }

    }
}


import java.util.Scanner;

public class Mountain_Scenery {
	public static void main(String[] args) {
		Scanner sc1 = new Scanner(System.in);
		int aux = 0;
		int n = ((2 * sc1.nextInt()) + 1);
		int k = sc1.nextInt();
		long arr[] = new long[n];

		do{
	    	arr[aux] = sc1.nextInt();
	    	aux++;
	    }while(aux < n);

		int i = 1;
		aux = 1;
	    for(;aux <= k; i+=2){
	    	if(arr[i]-1 > arr[i-1] && arr[i]-1 > arr[i+1]){
	    		arr[i] = arr[i]-1;
	    	}
	    	aux++;
	    }

	    for(i = 0; i < n; i++){
	    	System.out.printf("%d ", arr[i]);
	    }
	}
}


import java.util.Scanner;

public class Mountain_Scenery {
	public static void main(String[] args) {
		Scanner sc1 = new Scanner(System.in);
		int aux = 0;
		int n = ((2 * sc1.nextInt()) + 1);
		int k = sc1.nextInt();
		long arr[] = new long[n];

		do{
	    	arr[aux] = sc1.nextInt();
	    	aux++;
	    }while(aux < n);

		int i = 1;
		aux = 1;
	    for(;aux <= k; i+=2){
	    	if(arr[i] > arr[i-1] && arr[i] > arr[i+1]){
	    		arr[i] = arr[i]-1;
	    	}
	    	aux++;
	    }

	    for(i = 0; i < n; i++){
	    	System.out.printf("%d ", arr[i]);
	    }
	}
}


import java.util.Scanner;

public class Mountain_Scenery {
	public static void main(String[] args) {
		Scanner sc1 = new Scanner(System.in);
		int aux = 0;
		int n = ((2 * sc1.nextInt()) + 1);
		int k = sc1.nextInt();
		long arr[] = new long[n];

		do{
	    	arr[aux] = sc1.nextInt();
	    	aux++;
	    }while(aux < n);

		int i = 1;
		aux = 1;
	    for(;aux <= k; i+=2){
	    	if(arr[i]-1 > arr[i-1] && arr[i]-1 > arr[i+1]){
	    		arr[i] = arr[i]-1;
	    		aux++;
	    	}
	    	//System.out.printf("%d ", aux);
	    }

	    for(i = 0; i < n; i++){
	    	System.out.printf("%d ", arr[i]);
	    }
	}
}


import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		int n = sc.nextInt(), k = sc.nextInt();

		int prev = 0,next = 0;

		for(int i = 1 ; i <= 2*n+1 ; i++) {
			int x = sc.nextInt();

			if(i%2==0) {
				next = sc.nextInt();
				if(x-prev > 1 && x-next > 1 && k >0) {
					System.out.print(--x + " " + next + " ");
					k--;
				}else
					System.out.print(x + " " + next + " ");
				i++;
				prev = next;
			}else {
				System.out.print(x + " ");
				prev = x;
			}

		}
		sc.close();
	}
}


import java.util.Scanner;

public class MountainScenery {

	public static void main(String[] args) {
		int  numOfMountainPeaks , kMountainPeaks , numOfPoints;
		int points [];
		Scanner s = new Scanner(System.in);
		numOfMountainPeaks = s.nextInt();
		kMountainPeaks = s.nextInt();
		numOfPoints = 2*numOfMountainPeaks + 1;
		points = new int [numOfPoints+1];

		for (int i=0 ; i < numOfPoints ;i++) {
			if(i%2 !=0 && kMountainPeaks > 0) {
				points[i] = s.nextInt() -1;
				kMountainPeaks --;
			}
			else {
				points[i] = s.nextInt() ;
			}

		}

		for (int i=0 ;i<numOfPoints ;i++) {
			System.out.print(points[i]+" ");
		}

	}

}


import java.util.Scanner;

public class MountainScenery {

	public static void main(String[] args) {
		int  numOfMountainPeaks , kMountainPeaks , numOfPoints , tempVar;
		int points [];
		Scanner s = new Scanner(System.in);
		numOfMountainPeaks = s.nextInt();
		kMountainPeaks = s.nextInt();
		numOfPoints = 2*numOfMountainPeaks + 1;
		points = new int [numOfPoints+1];

		for (int i=0 ; i < numOfPoints ;i++) {

				points[i] = s.nextInt() ;

		}

		for (int i=0 ;i<numOfPoints -1 ;i++) {
            if(i%2 !=0 && kMountainPeaks > 0) {
            	tempVar = points[i] - 1 ;
            	if(tempVar>points[i-1] && tempVar>points[i+1]) {
				    points[i] =tempVar;
				    kMountainPeaks --;
            	}
			}

		}
		for (int i=0 ;i<numOfPoints ;i++) {
			System.out.print(points[i]+" ");
		}

	}

}


import java.util.Scanner;

public class MountainScenery{

	public static void main(String[] args){
		int n,k;
		int prec,suiv;
		Scanner saisir =new Scanner(System.in);
		n=saisir.nextInt();
		k=saisir.nextInt();
		int t[]=new int[2*n+1];
		int i;
		for(i=0;i<=2*n;i++)
		{
			t[i]=saisir.nextInt();
		}
		i=1;
        prec=0;
        suiv=2;
		while(k!=0)
		{
			//System.out.println("Avant le changement prec= "+prec+" somme= "+t[i]+" suivant "+suiv);
            if(t[i]>t[prec] && t[i]>t[suiv])
            {
            	//System.out.println("prec= "+t[prec]+" somme= "+t[i]+" suivant "+t[suiv]);
            	k=k-1;
            	t[i]=t[i]-1;
            	//System.out.println("la valeur du nouveau somme est "+t[i]);
            }
           prec=prec+1;
           suiv=suiv+1;
           i=i+1;
		}
		for(i=0;i<=2*n;i++)
		{
			System.out.print(t[i]+"  ");
		}
	}
}


import java.util.Scanner;

public class MountainScenery{

	public static void main(String[] args){
		int n,k;
		int prec,suiv;
		Scanner saisir =new Scanner(System.in);
		n=saisir.nextInt();
		k=saisir.nextInt();
		int t[]=new int[2*n+1];
		int i;
		for(i=0;i<=2*n;i++)
		{
			t[i]=saisir.nextInt();
		}
		i=1;
        prec=0;
        suiv=2;
		while(k!=0)
		{

            if(t[i]>t[prec] && t[i]>t[suiv])
            {

            	t[i]=t[i]-1;

            }
           prec=prec+1;
           suiv=suiv+1;
           i=i+1;
		}
		for(i=0;i<=2*n;i++)
		{
			System.out.print(t[i]+"  ");
		}
	}
}


import java.util.Scanner;

public class MountainScenery{

	public static void main(String[] args){
		int n,k;
		int prec,suiv;
		Scanner saisir =new Scanner(System.in);
		n=saisir.nextInt();
		k=saisir.nextInt();
		int t[]=new int[2*n+1];
		int i;
		for(i=0;i<=2*n;i++)
		{
			t[i]=saisir.nextInt();
		}
		i=1;
        prec=0;
        suiv=2;
		while(k!=0)
		{
			System.out.println("Avant le changement prec= "+prec+" somme= "+t[i]+" suivant "+suiv);
            if(t[i]>t[prec] && t[i]>t[suiv])
            {
            	System.out.println("prec= "+t[prec]+" somme= "+t[i]+" suivant "+t[suiv]);
            	k=k-1;
            	t[i]=t[i]-1;
            	System.out.println("la valeur du nouveau somme est "+t[i]);
            }
           prec=prec+1;
           suiv=suiv+1;
           i=i+1;
		}
		for(i=0;i<=2*n;i++)
		{
			System.out.print(t[i]+"  ");
		}
	}
}


import java.util.Scanner;

public class MountainScenery{

	public static void main(String[] args){
		int n,k;
		int prec,suiv;
		Scanner saisir =new Scanner(System.in);
		n=saisir.nextInt();
		k=saisir.nextInt();
		int t[]=new int[2*n+1];
		int i;
		for(i=0;i<=2*n;i++)
		{
			t[i]=saisir.nextInt();
		}
		i=1;
        prec=0;
        suiv=2;
		while(k!=0)
		{
			//System.out.println("Avant le changement prec= "+prec+" somme= "+t[i]+" suivant "+suiv);
            if(t[i]-1>t[prec] && t[i]-1>t[suiv])
            {
            	//System.out.println("prec= "+t[prec]+" somme= "+t[i]+" suivant "+t[suiv]);
            	k=k-1;
            	t[i]=t[i]-1;
            	//System.out.println("la valeur du nouveau somme est "+t[i]);
            }
           prec=prec+1;
           suiv=suiv+1;
           i=i+1;
		}
		for(i=0;i<=2*n;i++)
		{
			System.out.print(t[i]+"  ");
		}
	}
}


import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner s = new Scanner(System.in);
        int n = s.nextInt();
        int k = s.nextInt();
        int noOfPoints = 2 * n + 1;
        int[] points = new int[noOfPoints];
        int j = 0;
        while(noOfPoints-- > 0) {
            points[j++] = s.nextInt();
        }

        for(int i = 1; i < points.length && k > 0; i+=2) {
            if(points[i-1] + 1 < points[i] && points[i+1] + 1 < points[i]) {
                points[i]--;
                k--;
            }
        }

        for(int i = 0; i < points.length; i++) {
            System.out.print(points[i] + " ");
        }
        System.out.println();

    }
}


import java.util.Scanner;

public class Solution {

    public static void main(String[] args) {

        Scanner scan = new Scanner(System.in);

        int n = scan.nextInt();
        int k = scan.nextInt();

        int[] a = new int[2 * n + 1];

        for (int i = 0; i < 2 * n + 1; i++) {
            a[i] = scan.nextInt();
        }

        for (int i = 0; i < 2 * n + 1; i++) {
            if (k != 0 &&
                    a[i] != 0 &&
                    a[i] - 1 != a[i + 1] &&
                    a[i] - 1 != a[i - 1] &&
                    i % 2 != 0) {
                a[i] -= 1;
                k--;

            }
            System.out.print(a[i] + " ");

        }

        scan.close();

    }
}


import java.util.Scanner;

public class Solution {

    public static void main(String[] args) {

        Scanner scan = new Scanner(System.in);

        int n = scan.nextInt();
        int k = scan.nextInt();

        int[] a = new int[2 * n + 1];

        for (int i = 0; i < 2 * n + 1; i++) {
            a[i] = scan.nextInt();
        }

        for (int i = 0; i < 2 * n + 1; i++) {
            if (k != 0 &&
                    i % 2 != 0 &&
                    a[i] != 0 &&
                    a[i] - 1 != a[i + 1] &&
                    a[i] - 1 != a[i - 1]
                    ) {
                a[i] -= 1;
                k--;

            }
            System.out.print(a[i] + " ");

        }

        scan.close();

    }
}


import java.util.Scanner;

public class Solution {

    public static void main(String[] args) {

        Scanner scan = new Scanner(System.in);

        int n = scan.nextInt();
        int k = scan.nextInt();

        int[] a = new int[2 * n + 1];

        for (int i = 0; i < 2 * n + 1; i++) {
            a[i] = scan.nextInt();
        }

        for (int i = 0; i < a.length; i++) {
            if (a[i] != 0 &&
                    a[i] - 1 != a[i + 1] &&
                    a[i] - 1 != a[i - 1]) {
                a[i] -= 1;
                k--;
                if (k == 0) {
                    break;
                }
            }

        }

        for (int num : a) {
            System.out.print(num + " ");
        }

        scan.close();

    }
}


import java.util.Scanner;

public class MountainScenery {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int k = scanner.nextInt();

        int[] y = new int[2 * n + 1];

        for (int i = 0; i < y.length; i++) {

            y[i] = scanner.nextInt();

        }

        int count = 0;

        for (int i = 0, j = 1; i < y.length; i++, j++) {
            if (count == k) {
                break;
            }

            if (y[i] != 0) {
                if (i == 0 || i == (y.length - 1)) {
                    y[i]--;
                    count++;

                } else {
                    if (j % 2 == 0) {
                        if (y[i] > (y[i - 1] + 1) && y[i] > (y[i + 1] + 1)) {
                            y[i]--;
                            count++;
                        } else {
                            y[i]++;
                            count++;
                        }
                    }
                }
            }
        }

        for (int element : y) {
            System.out.print(element + " ");
        }
    }
}


import java.util.Scanner;

public class MountainScenery {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int k = scanner.nextInt();

        int[] y = new int[2 * n + 1];

        for (int i = 0; i < y.length; i++) {

            y[i] = scanner.nextInt();

        }

        int count = 0;

        for (int i = 0, j = 1; i < y.length; i++, j++) {
            if (count == k) {
                break;
            }

            if (y[i] != 0) {
                if (i == 0 || i == (y.length - 1)) {
                    y[i]--;
                    count++;

                } else {
                    if (j % 2 == 0) {
                        if (y[i] > (y[i - 1] + 1) && y[i] > (y[i + 1] + 1)) {
                            y[i]--;
                            count++;
                        }
                    } else {
                        y[i]--;
                        count++;
                    }
                }
            }
        }

        for (int element : y) {
            System.out.print(element + " ");
        }
    }
}


import java.util.Scanner;

public class MountainScenery {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int k = scanner.nextInt();

        int[] y = new int[2 * n + 1];

        for (int i = 0; i < y.length; i++) {

            y[i] = scanner.nextInt();

        }

        int count = 0;

        for (int i = 0, j = 1; i < y.length; i++, j++) {
            if (count == k) {
                break;
            }

            if (y[i] != 0) {
                if (i == 0 || i == (y.length - 1)) {
                    y[i]--;
                    count++;

                } else {
                    if (j % 2 == 0) {
                        if (y[i] > (y[i - 1] + 1) && y[i] > (y[i + 1] + 1)) {
                            y[i]--;
                            count++;
                        }
                    }
                }
            }
        }

        for (int element : y) {
            System.out.print(element + " ");
        }
    }
}


import java.util.Scanner;

public class MountainScenery {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int k = scanner.nextInt();

        int[] y = new int[2 * n + 1];

        for (int i = 0; i < y.length; i++) {

            y[i] = scanner.nextInt();

        }

        int count = 0;

        for (int i = 0, j = 1; i < y.length; i++, j++) {
            if (count == k) {
                break;
            }

            if (y[i] != 0) {
                if (i != 0 && i != (y.length - 1)) {
                    if (j % 2 == 0) {
                        if (y[i] > (y[i - 1] + 1) && y[i] > (y[i + 1] + 1)) {
                            y[i]--;
                            count++;
                        }
                    }
                }
            }
        }

        for (int element : y) {
            System.out.print(element + " ");
        }
    }
}


import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author OmarYasser
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskA solver = new TaskA();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskA {
        public void solve(int testNumber, Scanner sc, PrintWriter out) {
            int n = 1 + 2 * sc.nextInt(), k = sc.nextInt();
            int[] a = new int[n];
            boolean[] changed = new boolean[n];
            for (int i = 0; i < n; i++)
                a[i] = sc.nextInt();
            for (int i = 1; i < n && k > 0; i += 2) {
                if (a[i] - 1 > a[i - 1] && a[i] - 1 > a[i + 1]) {
                    k--;
                    changed[i] = true;
                    a[i]--;
                }
            }

            for (int i = 0; i < n; i++) {
                if (i > 0) out.print(" ");
                out.print(a[i]);
            }
            out.println();
        }

    }

    static class Scanner {
        StringTokenizer st;
        BufferedReader br;

        public Scanner(InputStream s) {
            br = new BufferedReader(new InputStreamReader(s));
        }

        public Scanner(FileReader f) {
            br = new BufferedReader(f);
        }

        public String next() {
            while (st == null || !st.hasMoreTokens())
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (Exception e) {
                }
            return st.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

    }
}


import java.util.*;
import java.io.*;
import java.math.*;
public final class Solution
{
    public static void main(String[] args)
    {
        Reader input = new Reader();
        PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out));
        int n = 2 * input.nextInt() + 1, k = input.nextInt();
        int[] arr = new int[n];
        for(int i = 0 ; i < n ; i++)
        	arr[i] = input.nextInt();
        for(int i = 1 ; i < n - 1 ; i += 2)
        {
        	if(arr[i] - 2 >= arr[i - 1] && arr[i] - 2 >= arr[i+1] && k != 0)
        	{
        		arr[i]--;
        		k--;
        	}
        }
        for(int i = 0 ; i < n ; i++)
        	out.print(arr[i] + " ");
        out.close();
    }
    public static class Reader
    {
    	BufferedReader br;
    	StringTokenizer st;
    	public Reader()
    	{
    		br = new BufferedReader(new InputStreamReader(System.in));
    	}
    	public String next()
    	{
    		try
    		{
        		if(st == null || !st.hasMoreTokens())
        			st = new StringTokenizer(br.readLine());
    		}
    		catch(IOException ex)
    		{
    			ex.printStackTrace();
    			System.exit(1);
    		}
    		return st.nextToken();
    	}
    	public int nextInt()
    	{
    		return Integer.parseInt(next());
    	}
    	public double nextDouble()
    	{
    		return Double.parseDouble(next());
    	}
    	public long nextLong()
    	{
    		return Long.parseLong(next());
    	}
    	public String nextLine()
    	{
    		try
    		{
    			return br.readLine();
    		}
    		catch(IOException ex)
    		{
    			ex.printStackTrace();
    			System.exit(1);
    		}
    		return "";
    	}
    }
}


import java.util.*;
public class MountainScenery {
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int n=in.nextInt();
		int k=in.nextInt();
		int[] arr=new int[2*n+1];
		for(int i=0;i<arr.length;i++)
			arr[i]=in.nextInt();
		while (k!=0) {
			for(int i=1;i<arr.length&&k!=0;i+=2) {
				if(arr[i]>arr[i+1]&&arr[i]>arr[i-1]) {
					arr[i]--;
					k--;
				}
			}
		}
		for(int i:arr) {
			System.out.print(i+" ");
		}
	}
}


import java.util.*;
public class MountainScenery {
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int n=in.nextInt();
		int k=in.nextInt();
		int[] arr=new int[2*n+1];
		for(int i=0;i<arr.length;i++)
			arr[i]=in.nextInt();
		while (k!=0) {
			for(int i=1;i<arr.length&&k!=0;i+=2) {
				int x=arr[i]-1;
				if(x>arr[i+1]&&x>arr[i-1]) {
					arr[i]--;
					k--;
				}
			}
		}
		for(int i:arr) {
			System.out.print(i+" ");
		}
	}
}


import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskA solver = new TaskA();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskA {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int n = in.nextInt();
            int k = in.nextInt();
            int[] r = new int[2 * n + 1];
            for (int i = 0; i < 2 * n + 1; i++) {
                r[i] = in.nextInt();
            }
            out.print(r[0] + " ");
            for (int i = 1; i < 2 * n; i++) {
                if (k > 0 && i % 2 == 1 && r[i - 1] < r[i] - 1 && r[i + 1] < r[i] - 1) {
                    r[i]--;
                    k--;
                }
                out.print(r[i] + " ");
            }
            out.print(r[2 * n]);
        }

    }

    static class InputReader {
        private StringTokenizer tokenizer;
        private BufferedReader reader;

        public InputReader(InputStream inputStream) {
            reader = new BufferedReader(new InputStreamReader(inputStream));
        }

        private void fillTokenizer() {
            if (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (Exception e) {
                    throw new RuntimeException(e);
                }
            }
        }

        public String next() {
            fillTokenizer();
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

    }
}


import java.util.*;

public class Problem55 {

	public static void main(String[] args) {

		Scanner read=new Scanner(System.in);

		int n=read.nextInt(),k=read.nextInt();
		int[] a=new int[(2*n)+1];
		for(int i=0 ; i<=2*n ; i++) {
			a[i]=read.nextInt();
		}
		for(int j=0 ; j<=(2*n) ; j++) {
			if((j+1)%2==0 && k>0) {
				if((a[j]-1>a[j-1]) && (a[j]-1>a[j+1])) {
					System.out.print(a[j]-1+" ");
					k--;
				}else {
					System.out.print(a[j]+" ");
				}
			}else {
				System.out.print(a[j]+" ");
			}

		}
	}

}


import java.util.Arrays;
import java.util.Scanner;

public class Sol {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int k = sc.nextInt();
        int c = 0;
        int [] arr = new int[2*n+1];
        int [] cpy = new int[2*n+1];
        for (int i = 0; i < 2*n+1; i++) {
            arr[i] = sc.nextInt();
            cpy[i] = arr[i];
        }
        for (int j = 0; j < k; j++) {
            int max = 0;
            for (int h = 0; h < 2*n+1; h++) {
                    max = Math.max(max, arr[h]);
            }
            for (int p = 0, o = 0; p < 2*n+1 ; p++) {
                if(max == arr[p]){
                    if(p != 0 && p != (2*n+1)-1 && arr[p-1] < arr[p]-1 && arr[p] -1 > arr[p+1]) {
                        cpy[p] = --arr[p];
                    }
                    else {
                        j--;
                    }
                    arr[p] = 0;
                    break;
                }
            }
        }
        for (int i = 0; i < 2*n+1; i++) {
            System.out.print(cpy[i]+ " ");
        }
    }
}


import java.util.Arrays;
import java.util.Scanner;

public class Sol {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int k = sc.nextInt();
        int c = 0;
        int [] arr = new int[2*n+1];
        int [] cpy = new int[2*n+1];
        for (int i = 0; i < 2*n+1; i++) {
            arr[i] = sc.nextInt();
            cpy[i] = arr[i];
        }
        for (int j = 0; j < k; j++) {
            int max = 0;
            for (int h = 0; h < 2*n+1; h++) {
                    max = Math.max(max, arr[h]);
            }
            for (int p = 0, o = 0; p < 2*n+1 ; p++) {
                if(max == arr[p]){
                    if(p != 0 && p != (2*n+1)-1 && arr[p-1] < arr[p]-1 && arr[p] -1 > arr[p+1] && p%2 != 0) {
                        cpy[p] = --arr[p];
                    }
                    else {
                        j--;
                    }
                    arr[p] = 0;
                    break;
                }
            }
        }
        for (int i = 0; i < 2*n+1; i++) {
            System.out.print(cpy[i]+ " ");
        }
    }
}


import java.util.Arrays;
import java.util.Scanner;

public class Sol {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int k = sc.nextInt();
        int c = 0;
        int [] arr = new int[2*n+1];
        int [] cpy = new int[2*n+1];
        for (int i = 0; i < 2*n+1; i++) {
            arr[i] = sc.nextInt();
            cpy[i] = arr[i];
        }
        for (int j = 0; j < k; j++) {
            int max = 0;
            for (int h = 0; h < 2*n+1; h++) {
                    max = Math.max(max, arr[h]);
            }
            for (int p = 0, o = 0; p < 2*n+1 ; p++) {
                if(max == arr[p]){
                    cpy[p] = --arr[p];
                    arr[p] = 0;
                    break;
                }
            }
        }
        for (int i = 0; i < 2*n+1; i++) {
            System.out.print(cpy[i]+ " ");
        }
    }
}


import java.util.Arrays;
import java.util.Scanner;

public class Sol {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int k = sc.nextInt();
        int c = 0;
        int [] arr = new int[2*n+1];
        int max = 0;
        for (int i = 0; i < 2*n+1; i++) {
            arr[i] = sc.nextInt();
            max = Math.max(max, arr[i]);
        }
        for (int i = 0; i < 2*n+1; i++) {
            if(arr[i] == max){
                arr[i] = --arr[i];
                c++;
            }
            if(c == k){
                for (int j = 0; j < 2*n+1; j++) {
                    System.out.print(arr[j]+ " ");
                }
                return;
            }
        }
    }
}


import java.util.Arrays;
import java.util.Scanner;

public class Sol {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int k = sc.nextInt();
        int c = 0;
        int [] arr = new int[2*n+1];
        int [] cpy = new int[2*n+1];
        for (int i = 0; i < 2*n+1; i++) {
            arr[i] = sc.nextInt();
            cpy[i] = arr[i];
        }
        for (int j = 0; j < k; j++) {
            int max = 0;
            for (int h = 0; h < 2*n+1; h++) {
                    max = Math.max(max, arr[h]);
            }
            for (int p = 0, o = 0; p < 2*n+1 ; p++) {
                if(max == arr[p] && (arr[p-1] < arr[p]-1 && arr[p] -1 > arr[p+1])){
                    cpy[p] = --arr[p];
                    arr[p] = 0;
                    break;
                }
            }
        }
        for (int i = 0; i < 2*n+1; i++) {
            System.out.print(cpy[i]+ " ");
        }
    }
}


import java.util.Scanner;
public class abdo  {
public static void main(String[] args){
Scanner abd = new Scanner(System.in);
       int n=abd.nextInt(),s=0;
       int m=abd.nextInt(),k=0;
       int[]x=new int[n*2+1];

       for(int i=0;i<2*n+1;i++){
           x[i]=abd.nextInt();
       }
       for(int i=0;i<=2*n;i++){
           for(int j=1;j<=2*n;j++){
               if(x[j]>x[j-1]+1&&x[j]>x[j+1]+1){
                   x[j]--;
                   m--;
                   if(m==0)
                   break;
               }
           }
           if(m==0)
               break;
       }
       for(int j=0;j<n*2+1;j++)
           System.out.print(x[j]+" ");
}}


import java.util.Arrays;

import java.util.Scanner;
public class abdo  {
public static void main(String[] args){
Scanner abd = new Scanner(System.in);
       int n=abd.nextInt(),s=0;
       int m=abd.nextInt(),k=0;
       int[]x=new int[n*2+1];
       int[]z=new int[n*2+1];
       for(int i=0;i<2*n+1;i++){
           x[i]=abd.nextInt();
           z[i]=x[i];
       }
       Arrays.sort(z);
       for(int i=2*n;i>=0;i--){
           for(int j=2*n;j>=0;j--){
               if(x[j]==z[i]){
                   x[j]--;
                   s++;
                   break;
               }
           }
           if(s==m)
               break;
       }
       for(int j=0;j<n*2+1;j++)
           System.out.print(x[j]+" ");
}}


import java.util.Scanner;

public class JavaApplication37 {

    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
         int n=sc.nextInt();
         int k=sc.nextInt();
         int [] c=new int [2*n+1];
         for (int i=0;i<2*n+1;i++){
             c[i]=sc.nextInt();

         }
         for (int i=0;i<2*n+1;i++){
             if(i%2==1&&k!=0&&c[i]>c[i-1]+1&&c[i]>c[i+1]+1){
                 k--;
                 System.out.print(c[i]-1+" ");

             }
             else System.out.print(c[i]+" ");
         }
            }}


import java.io.*;
import java.util.*;

public class MountainScenery {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        int n = input.nextInt();
        int k  = input.nextInt();

        int[] a = new int[2*n+1];
        for (int i = 0; i < a.length; i++) {
            a[i] = input.nextInt();
        }

        for (int i = 1; i < a.length -1 ; i+=2) {

            if(k == 0)
                break;
            if(a[i]-1 > a[i-1] && a[i]-1 > a[i+1] ){
                a[i] = a[i]-1;
                k--;
            }

        }

        System.out.print(a[0]);
        for (int i = 1; i < a.length; i++) {
            System.out.print(" "+ a[i]);
        }
        System.out.println("");

    }
}


import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        int k = in.nextInt();
        int[] a = new int[2 * n + 1];
        for (int i = 0; i < a.length; i++) {
            a[i] = in.nextInt();
        }

        for (int i = 1; i < a.length && k > 0; i+=2) {
            if(a[i] - 1 > a[i - 1] && a[i] - 1 > a[i+1]){
                k--;
                a[i]--;
            }
        }
        for (int i = 0; i < a.length; i++) {
            System.out.print(a[i]);
            if(i < a.length - 1)
                System.out.print(" ");
            else
                System.out.println("");
        }
    }
}


#include<stdio.h>
#include<string.h>
int main(){
	int n,i;
	scanf("%d",&n);
	int h[100],min=101,max=0;
	for(i=0;i<n;i++){
		scanf("%d",&h[i]);
		if(h[i]>max)
		max=h[i];
		if(h[i]<min)
		min=h[i];
	}
	int t=0,maxi,mini;
	for(i=0;i<n;i++){
		if(max==h[i]){
			t=t+i;
			maxi=i;
			break;
		}
	}
	for(i=n-1;i>0;i--){
		if(min==h[i]){
			t=t+(n-1-i);
			mini=(n-1-i);
			break;
		}
	}
	if(maxi>mini && n>2)
		t--;

	printf("%d",t);
	return 0;
}


#include<stdio.h>
#include<string.h>
int main(){
	int n,i;
	scanf("%d",&n);
	int h[100],min=101,max=0;
	for(i=0;i<n;i++){
		scanf("%d",&h[i]);
		if(h[i]>max)
		max=h[i];
		if(h[i]<min)
		min=h[i];
	}
	int t=0,maxi,mini;
	for(i=0;i<n;i++){
		if(max==h[i]){
			t=t+i;
			maxi=i;
			break;
		}
	}
	for(i=n-1;i>0;i--){
		if(min==h[i]){
			t=t+(n-1-i);
			mini=(i);
			break;
		}
	}
	if(maxi>mini && n>2)
		t--;

	printf("%d",t);
	return 0;
}


#include<stdio.h>
#include<string.h>
int main(){
	int n,i;
	scanf("%d",&n);
	int h[100],min=101,max=0;
	for(i=0;i<n;i++){
		scanf("%d",&h[i]);
		if(h[i]>max)
		max=h[i];
		if(h[i]<min)
		min=h[i];
	}
	int t=0,maxi,mini;
	for(i=0;i<n;i++){
		if(max==h[i]){
			t=t+i;
			maxi=i;
		}
	}
	for(i=n-1;i>0;i--){
		if(min==h[i]){
			t=t+(n-1-i);
			mini=(n-1-i);
		}
	}
	if(maxi>mini)
		t--;

	printf("%d",t);
	return 0;
}


#include<stdio.h>
#include<string.h>
int main(){
	int n,i;
	scanf("%d",&n);
	int h[101],min=101,max=0;
	for(i=0;i<n;i++){
		scanf("%d",&h[i]);
		if(h[i]>max)
		max=h[i];
		if(h[i]<min)
		min=h[i];
	}
	int t=0,maxi,mini;
	for(i=0;i<n;i++){
		if(max==h[i]){
			t=t+i;
			maxi=i;
			break;
		}
	}
	for(i=n-1;i>-1;i--){
		if(min==h[i]){
			t=t+(n-1-i);
			mini=(i);
			break;
		}
	}
	if(maxi>mini && n>2)
		t--;

	printf("%d",t);
	return 0;
}


#include<stdio.h>
#include<string.h>
int main(){
	int n,i;
	scanf("%d",&n);
	int h[100],min=101,max=0;
	for(i=0;i<n;i++){
		scanf("%d",&h[i]);
		if(h[i]>max)
		max=h[i];
		if(h[i]<min)
		min=h[i];
	}
	printf(" max %d    min %d ",max,min);
	int t=0,maxi,mini;
	for(i=0;i<n;i++){
		if(max==h[i]){
			t=t+i;
			maxi=i;
			break;
		}
	}
	for(i=n-1;i>0;i--){
		if(min==h[i]){
			printf(" i is %d",i);
			t=t+(n-1-i);
			mini=(i);
			break;
		}
	}
	if(maxi>mini && n>2)
		t--;

	printf("%d",t);
	return 0;
}


#include<stdio.h>
#include<string.h>
int main(){
	int n,i;
	scanf("%d",&n);
	int h[101],min=101,max=0;
	for(i=0;i<n;i++){
		scanf("%d",&h[i]);
		if(h[i]>max)
		max=h[i];
		if(h[i]<min)
		min=h[i];
	}
	int t=0,maxi,mini;
	for(i=0;i<n;i++){
		if(max==h[i]){
			t=t+i;
			maxi=i;
			break;
		}
	}
	for(i=n-1;i>-1;i--){
		if(min==h[i]){
			t=t+(n-1-i);
			mini=(i);
			break;
		}
	}

	if(maxi>mini )
		t--;

	printf("%d",t);
	return 0;
}


#include<stdio.h>
#include<string.h>
int main(){
	int n,i;
	scanf("%d",&n);
	int h[100],min=101,max=0;
	for(i=0;i<n;i++){
		scanf("%d",&h[i]);
		if(h[i]>max)
		max=h[i];
		if(h[i]<min)
		min=h[i];
	}
	int t=0,maxi,mini;
	for(i=0;i<n;i++){
		if(max==h[i]){
			t=t+i;
			maxi=i;
		}
	}
	for(i=n-1;i>0;i--){
		if(min==h[i]){
			t=t+(n-1-i);
			mini=(n-1-i);
		}
	}
	if(maxi>mini && n>2)
		t--;

	printf("%d",t);
	return 0;
}


#include<stdio.h>
#include<string.h>
int main(){
	int n,i;
	scanf("%d",&n);
	int h[100],min=101,max=0;
	for(i=0;i<n;i++){
		scanf("%d",&h[i]);
		if(h[i]>max)
		max=h[i];
		if(h[i]<min)
		min=h[i];
	}
	int t=0,maxi,mini;
	for(i=0;i<n;i++){
		if(max==h[i])
			t=t+i;
			maxi=i;
	}
	for(i=n-1;i>0;i--){
		if(min==h[i])
			t=t+(n-1-i);
			mini=(n-1-i);
	}
	if(maxi>mini)
		t--;

	printf("%d",t);
	return 0;
}


#include<stdio.h>
int main ()
{
	int i,n,p,q,x,min=100;
	scanf("%d",&n);
	int a[n];
	int max=0;
	for(i=0;i<n;i++)
	{
		scanf("%d",&a[i]);
		if(a[i]>max)
		{max=a[i];
			p=i;
		}
		else{
		if (a[i]<=min)
		{min =a[i];
			q=i;

		}}
	}
int l=(p+n-1-q),m=(p+n-2-q);

if (p>q)
	printf("%d",l);
else
 printf("%d",m);

	return 0;
}


#include<stdio.h>
int main ()
{
	int i,n,p,q,x,min=100;
	scanf("%d",&n);
	int a[n];
	int max=0;
	for(i=0;i<n;i++)
	{
		scanf("%d",&a[i]);
		if(a[i]>max)
		{max=a[i];
			p=i;
		}
		else{
		if (a[i]<=min)
		{min =a[i];
			q=i;

		}}
	}
int l=(p+n-2-q),m=(p+n-2-q);

if (p>q)
	printf("%d",l);
else
 printf("%d",m);

	return 0;
}


#include<stdio.h>
int main ()
{
        int l=0,m=0,i,n,p=0,q=0,x,min=100;
        scanf("%d",&n);
        int a[n];
        int max=0;
        for(i=0;i<n;i++)
        {
                scanf("%d",&a[i]);
                if(a[i]>max)
                {max=a[i];
                        p=i;
                }}

for(i=0;i<n;i++)
{
                if (a[i]<=min)
                {min =a[i];
                        q=i;

                }}

//printf("%d%d",p,q);

l=(p+n-1-q);
m=(p+n-2-q);
if (p>q)
 printf("%d",m);
else
 printf("%d",l);

        return 0;
}


#include<stdio.h>
int main ()
{
	int i,n,p,q,x,min=100;
	scanf("%d",&n);
	int a[n];
	int max=0;
	for(i=0;i<n;i++)
	{
		scanf("%d",&a[i]);
		if(a[i]>max)
		{max=a[i];
			p=i;
		}
		else{
		if (a[i]<=min)
		{min =a[i];
			q=i;

		}}
	}
if (p>q)
	printf("%d",(p+n-2-q));
else
 printf("%d",(p+n-1-q));

	return 0;
}


#include<stdio.h>
int main ()
{
        int l=0,m=0,i,n,p=0,q=0,x,min=100;
        scanf("%d",&n);
        int a[n];
        int max=0;
        for(i=0;i<n;i++)
        {
                scanf("%d",&a[i]);
                if(a[i]>max)
                {max=a[i];
                        p=i;
                }
                else{
                if (a[i]<=min)
                {min =a[i];
                        q=i;

                }}
        }
l=(p+n-1-q);
m=(p+n-2-q);

if (p>q)
 printf("%d",m);
else
 printf("%d",l);

        return 0;
}


#include<stdio.h>
int main ()
{
	int i,n,p,q,x,min=100;
	scanf("%d",&n);
	int a[n];
	int max=0;
	for(i=0;i<n;i++)
	{
		scanf("%d",&a[i]);
		if(a[i]>max)
		{max=a[i];
			p=i;
		}
		else{
		if (a[i]<=min)
		{min =a[i];
			q=i;

		}}
	}
if (p>q)
	printf("%d",(p+n-2-q));
else
 printf("%d%d%d",p,q,(p+n-1-q));

	return 0;
}


#include<stdio.h>
int main ()
{
	int i,n,p,q,x,min=100;
	scanf("%d",&n);
	int a[n];
	int max=0;
	for(i=0;i<n;i++)
	{
		scanf("%d",&a[i]);
		if(a[i]>max)
		{max=a[i];
			p=i;
		}
		else{
		if (a[i]<=min)
		{min =a[i];
			q=i;

		}}
	}
int l=(p+n-1-q),m=(p+n-2-q);

if (p>q)
	printf("%d",m);
else
 printf("%d",l);

	return 0;
}


#include<stdio.h>
int main ()
{
	int i,n,p,q,x,min=100;
	scanf("%d",&n);
	int a[n];
	int max=0;
	for(i=0;i<n;i++)
	{
		scanf("%d",&a[i]);
		if(a[i]>max)
		{max=a[i];
			p=i;
		}
		else{
		if (a[i]<=min)
		{min =a[i];
			q=i;

		}}
	}
if (p>q)
	printf("%d%d%d",p,q,(p+n-2-q));
else
 printf("%d%d%d",p,q,(p+n-1-q));

	return 0;
}


//you need to use string[length+1] to figure out the length, because the last element has '\0'

#include <stdio.h>

int main(){
    int n, i, t=0;
    scanf("%d", &n);

    int a[n], temp;
    int max_num = 0, min_num = 101, maxI, minI;
    for(i=0; i<n; i++){
        scanf("%d", &a[i]);
        if(a[i] > max_num){
            max_num = a[i];
            maxI = i;
        }
        else if(a[i] <= min_num){
            min_num = a[i];
            minI = i;
        }
    }

    if(minI < maxI){
        minI++;
    }
    t = maxI + n-1 - minI;

    printf("%d", t);

    return 0;
}


//you need to use string[length+1] to figure out the length, because the last element has '\0'

#include <stdio.h>

int main(){
    int n, i, t=0;
    scanf("%d", &n);

    int a[n], temp;
    int max_num = 0, min_num = 101, maxI, minI;
    for(i=0; i<n; i++){
        scanf("%d", &a[i]);
        if(a[i] > max_num){
            max_num = a[i];
            maxI = i;
        }
        else if(a[i] <= min_num){
            min_num = a[i];
            minI = i;
        }
    }
    while(maxI > 0){
        temp = a[maxI];
        a[maxI] = a[maxI-1];
        a[maxI-1] = temp;
        if(maxI-1 == minI){
            minI++;
        }
        maxI--;
        t++;
    }
    printf("%d\n", t);
    while(minI < n-1){
        temp = a[minI];
        a[minI] = a[minI+1];
        a[minI+1] = temp;
        minI++;
        t++;
    }
    printf("%d", t);

    return 0;
}


//you need to use string[length+1] to figure out the length, because the last element has '\0'

#include <stdio.h>

int main(){
    int n, i, t=0;
    scanf("%d", &n);

    int a[n], temp;
    int max_num = 0, min_num = 100, maxI, minI;
    for(i=0; i<n; i++){
        scanf("%d", &a[i]);
        if(a[i] > max_num){
            max_num = a[i];
            maxI = i;
        }
        else if(a[i] <= min_num){
            min_num = a[i];
            minI = i;
        }
    }
    while(maxI > 0){
        temp = a[maxI];
        a[maxI] = a[maxI-1];
        a[maxI-1] = temp;
        if(maxI-1 == minI){
            minI++;
        }
        maxI--;
        t++;
    }
    while(minI < n-1){
        temp = a[minI];
        a[minI] = a[minI+1];
        a[minI+1] = temp;
        minI++;
        t++;
    }
    printf("%d", t);

    return 0;
}


//you need to use string[length+1] to figure out the length, because the last element has '\0'

#include <stdio.h>

int main(){
    int n, i, t=0;
    scanf("%d", &n);

    int a[n], temp;
    int max_num = 0, min_num = 101, maxI=0, minI=0;
    for(i=0; i<n; i++){
        scanf("%d", &a[i]);
        if(a[i] > max_num){
            max_num = a[i];
            maxI = i;
        }
        else if(a[i] <= min_num){
            min_num = a[i];
            minI = i;
        }
    }
    if(minI < maxI){
        minI++;
    }
    t = maxI + n-1 - minI;

    printf("%d", t);

    return 0;
}