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-4 -3 -2 -1 0 1 2 10 11 12 13 14 100
 -5 -1 0
 -10 0 0 1 6 2 7
 Incorrect sequence
 -1 0 1 2 3 4
 0
 -10 0 -2 1 -1 2 0 3 1
 3 -2 5 -1 7 0 9 1 11 2
 -11 -2 -10 -1 0 0 10 1 11
 -1 -1 -1 0 0 0 1 1 1
 0 -1 10 0 11 1 12
 1000000000 1000000001 1000000002 1000000003 1000000004
 Incorrect sequence
 -11 -1 -10 0 -1 1 0
 -5 1 -13 -4 2 -12 -3 3 -11 -2 4 -10 -1 5 -9 0 6 -8 1 7 -7 2 8 -6 5 9 -5 6 10 -4 7 11 -3 8 12 -2 10 13 -1
 Incorrect sequence
 -2 -1 0 1 2 3 4
 -10 0 0 1 1 2 2
 -10 0 -7 1 -6 2 -1 3 0
 1 0 -1000000000 2 100 0 3
 -10 0 -3 1 -2 2 -1 3 0
 10 0 11 1 12 2 13 3 14
 -1 0 1
 -2 -1 0 1 2 3 4 5 6 10
 -1000000001 -1 -1000000000 0 0
 -1000000000 1000000000
 -10 0 -7 1 -6 2 0
 -1 0 0 0 2
 10 0 11 1 12 2 13
 -10 0 -2 1 -1 2 0
 -10 0 -1 1 0 2 1
 -11 -1 -10 0 10 1 11
 -3 -2 -1 0 1 3
 -10 0 -1 1 0 2 1 3 10
 Incorrect sequence
 -5 0 -1 -1 1 0 0 5 1
 -3 -2 -1 0 1 2 3 

import java.io.BufferedWriter;
import java.util.InputMismatchException;
import java.io.InputStream;
import java.util.NoSuchElementException;
import java.io.OutputStreamWriter;
import java.math.BigInteger;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.Writer;
import java.io.IOException;

/**
 * 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);
		OutputWriter out = new OutputWriter(outputStream);
		TaskE solver = new TaskE();
		solver.solve(1, in, out);
		out.close();
	}
}

 class TaskE {
    public void solve(int testNumber, InputReader in, OutputWriter out) {
        int n = in.readInt();
        int k = in.readInt();
        long[] a = new long[n];
        boolean[] known = new boolean[n];
        for (int i = 0; i < n; i++) {
            String s = in.readString();
            if (s.equals("?")) {
                known[i] = false;
            } else {
                known[i] = true;
                a[i] = Long.parseLong(s);
            }
        }

        for (int start = 0; start < k; start++) {
            int first = -1, last = n;
            for (int i = start; i < n; i += k) {
                if (known[i]) {
                    if (first == -1) {
                        first = i;
                    }
                    last = i;
                }
            }
            if (first == -1) {
                int cnt = 0;
                for (int i = start; i < n; i += k) {
                    cnt++;
                }
                long val = -(cnt / 2);
                for (int i = start; i < n; i += k) {
                    a[i] = val++;
                }
                continue;
            }
            int numHead = 0, numTail = 0;
            int numBetween = 0;
            for (int i = start; i < n; i += k) {
                if (!known[i]) {
                    if (i < first) numHead++;
                    if (i > last) numTail++;
                    if (first < i && i < last) numBetween++;
                }
            }
            if (numHead > 0) setHead(a, k, n, start, numHead, first);
            if (numTail > 0) setTail(a, k, n, start, numTail, last);
            if (numBetween == 0) {
                continue;
            }
            if (numBetween > 0 && numBetween > a[last] - a[first] - 1) {
                out.printLine("Incorrect sequence");
                return;
            }
            for (int L = first; L <= last; L += k) {
                int R = L + k;
                while (R <= last && !known[R]) R += k;
                R -= k;
                fill(L + k, R, a, k, n, (R - L) / k);
                L = R;
            }
        }

        long sum = 0;
        for (int i = 0; i < k; i++) {
            sum += a[i];
        }
        long prev = sum;
        for (int i = k; i < n; i++) {
            sum -= a[i - k];
            sum += a[i];
            if (sum <= prev) {
                out.printLine("Incorrect sequence");
                return;
            }
            prev = sum;
        }
        out.printLine(a);
    }

    private void fill(int l, int r, long[] a, int k, int n, int num) {
        if (l > r) {
            return;
        }
        if (num == 0) {
            return;
        }
        if (a[l - k] >= -1) {
            long val = a[l - k] + 1;
            for (int i = l; i <= r; i += k) {
                a[i] = val++;
            }
        } else if (a[r + k] <= 1) {
            long val = a[r + k] - 1;
            for (int i = r; i >= l; i -= k) {
                a[i] = val--;
            }
        } else {
            long valL = a[l - k] + 1, valR = a[r + k] - 1;
            long largest = num / 2;
            if (num % 2 != 0 && valL <= -largest && largest <= valR) {
                valL = -largest;
                valR = largest;
            }
            if (num % 2 == 0) {
                if (valL <= -largest + 1 && largest <= valR) {
                    valL = -largest + 1;
                    valR = largest;
                } else if (valL <= -largest && largest - 1 <= valR) {
                    valL = -largest;
                    valR = largest - 1;
                }
            }
            long sum1 = 0, sum2 = 0, sum3 = 0, sum4 = 0;
            {
                long val = a[l - k] + 1;
                for (int i = l; i <= r; i += k) {
                    a[i] = val;
                    sum1 += Math.abs(val++);
                }
            }
            {
                long val = a[r + k] - 1;
                for (int i = r; i >= l; i -= k) {
                    a[i] = val;
                    sum2 += Math.abs(val--);
                }
            }
            {
                long val = valL;
                for (int i = l; i <= r; i += k) {
                    a[i] = val;
                    sum3 += Math.abs(val++);
                }
            }
            {
                long val = valR;
                for (int i = r; i >= l; i -= k) {
                    a[i] = val;
                    sum4 += Math.abs(val--);
                }
            }
            if (sum1 <= sum2 && sum1 <= sum3 && sum1 <= sum4) {
                long val = a[l - k] + 1;
                for (int i = l; i <= r; i += k) {
                    a[i] = val;
                    sum1 += Math.abs(val++);
                }
            } else if (sum2 <= sum1 && sum2 <= sum3 && sum2 <= sum4) {
                long val = a[r + k] - 1;
                for (int i = r; i >= l; i -= k) {
                    a[i] = val;
                    sum2 += Math.abs(val--);
                }
            } else if (sum3 <= sum1 && sum3 <= sum2 && sum3 <= sum4) {
                long val = valL;
                for (int i = l; i <= r; i += k) {
                    a[i] = val;
                    sum3 += Math.abs(val++);
                }
            } else if (sum4 <= sum1 && sum4 <= sum2 && sum4 <= sum3) {
                long val = valR;
                for (int i = r; i >= l; i -= k) {
                    a[i] = val;
                    sum4 += Math.abs(val--);
                }
            } else {
                throw new RuntimeException();
            }
        }
    }

    private void setHead(long[] a, int k, int n, int start, int numHead, int first) {
        long val = a[first] - 1;
        if (val > 0 && val > numHead / 2) {
            val = numHead / 2;
        }
        for (int i = first - k; i >= 0; i -= k) {
            a[i] = val--;
        }
    }

    private void setTail(long[] a, int k, int n, int start, int numTail, int last) {
        long val = a[last] + 1;
        if (val < 0 && val < -(numTail / 2)) {
            val = -(numTail / 2);
        }
        for (int i = last + k; i < n; i += k) {
            a[i] = val++;
        }
    }
}


 class InputReader {

     private InputStream stream;
	private byte[] buf = new byte[1024];
	private int curChar;
	private int numChars;
	private SpaceCharFilter filter;

	public InputReader(InputStream stream) {
		this.stream = stream;
	}

	public int read() {
		if (numChars == -1)
			throw new InputMismatchException();
		if (curChar >= numChars) {
			curChar = 0;
			try {
				numChars = stream.read(buf);
			} catch (IOException e) {
				throw new InputMismatchException();
			}
			if (numChars <= 0)
				return -1;
		}
		return buf[curChar++];
	}

     public int readInt() {
		int c = read();
		while (isSpaceChar(c))
			c = read();
		int sgn = 1;
		if (c == '-') {
			sgn = -1;
			c = read();
		}
		int res = 0;
		do {
			if (c < '0' || c > '9')
				throw new InputMismatchException();
			res *= 10;
			res += c - '0';
			c = read();
		} while (!isSpaceChar(c));
		return res * sgn;
	}

     public String readString() {
		int c = read();
		while (isSpaceChar(c))
			c = read();
		StringBuilder res = new StringBuilder();
		do {
			if (Character.isValidCodePoint(c))
				res.appendCodePoint(c);
			c = read();
		} while (!isSpaceChar(c));
		return res.toString();
	}

	public boolean isSpaceChar(int c) {
		if (filter != null)
			return filter.isSpaceChar(c);
		return isWhitespace(c);
	}

	public static boolean isWhitespace(int c) {
		return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
	}

     public interface SpaceCharFilter {
		public boolean isSpaceChar(int ch);
	}
}


 class OutputWriter {
	private final PrintWriter writer;

	public OutputWriter(OutputStream outputStream) {
		writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
	}

	public OutputWriter(Writer writer) {
		this.writer = new PrintWriter(writer);
	}

     public void print(Object...objects) {
		for (int i = 0; i < objects.length; i++) {
			if (i != 0)
				writer.print(' ');
			writer.print(objects[i]);
		}
	}

     public void print(long[] array) {
        for (int i = 0; i < array.length; i++) {
            if (i != 0)
                writer.print(' ');
            writer.print(array[i]);
        }
    }

     public void printLine(long[] array) {
        print(array);
        writer.println();
    }

     public void printLine(Object...objects) {
		print(objects);
		writer.println();
	}

     public void close() {
		writer.close();
	}

 }


