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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.util.NoSuchElementException;
import java.math.BigInteger;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.Writer;
import java.io.IOException;
import java.io.InputStream;
import java.util.Collection;
import java.io.OutputStreamWriter;

/**
 * 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);
            }
        }
        EzIntArrayDeque queue = new EzIntArrayDeque();
        for (int i = 0; i < n; i++) {
            if (known[i]) {
                queue.add(i);
            }
        }
        boolean bad = false;
        while (!queue.isEmpty()) {
            int pos = queue.removeFirst();
            {
                int newPos = pos + k; if (newPos < 0 || newPos >= n) continue;
                if (!known[newPos]) {
                    known[newPos] = true;
                    a[newPos] = a[pos] + 1L;
                } else {
                    if (a[newPos] <= a[pos]) bad = true;
                }
            }
            {
                int newPos = pos - k; if (newPos < 0 || newPos >= n) continue;
                if (!known[newPos]) {
                    known[newPos] = true;
                    a[newPos] = a[pos] - 1L;
                } else {
                    if (a[newPos] >= a[pos]) bad = true;
                }
            }
        }
        if (bad) {
            out.printLine("Incorrect sequence");
            return;
        }
        int cntNotFilled = 0;
        for (boolean x : known) if (!x) cntNotFilled++;
        long first = -(cntNotFilled / 2);
        for (int i = 0; i < n; i++) {
            if (!known[i]) {
                a[i] = first++;
            }
        }
        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);
    }
}


 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();
	}

 }

 class EzIntArrayDeque implements EzIntDeque, EzIntList {
    private static final int DEFAULT_CAPACITY = 8;
    private static final int HASHCODE_INITIAL_VALUE = 0x811c9dc5;
    private static final int HASHCODE_MULTIPLIER = 0x01000193;

    private int[] deque;
    private int size;
    private int head;
    private int tail;
    private int mask;

    public EzIntArrayDeque() {
        this(DEFAULT_CAPACITY);
    }

    public EzIntArrayDeque(int capacity) {
        if (capacity < 0) {
            throw new IllegalArgumentException("Capacity must be non-negative");
        }
        if (capacity < 1) {
            capacity = 1;
        }
        if ((capacity & (capacity - 1)) != 0) {
            capacity = Integer.highestOneBit(capacity) << 1;
        }
        deque = new int[capacity];
        size = 0;
        head = 0;
        tail = 0;
        mask = deque.length - 1;
    }

    public EzIntArrayDeque(EzIntCollection collection) {
        this(collection.size() + 1);
        for (EzIntIterator iterator = collection.iterator(); iterator.hasNext(); ) {
            deque[tail++] = iterator.next();
        }
        size = collection.size();
    }

    public EzIntArrayDeque(int[] srcArray) {
        this(srcArray.length + 1);
        System.arraycopy(srcArray, 0, deque, 0, srcArray.length);
        tail = srcArray.length;
        size = srcArray.length;
    }

    public EzIntArrayDeque(Collection<Integer> javaCollection) {
        this(javaCollection.size() + 1);
        for (int element : javaCollection) {
            deque[tail++] = element;
        }
        size = javaCollection.size();
    }

    public int size() {
        return size;
    }

    public boolean isEmpty() {
        return size == 0;
    }

     public EzIntIterator iterator() {
        return new EzIntArrayDequeIterator();
    }

     public boolean add(int element) {
        deque[tail] = element;
        tail = (tail + 1) & mask;
        size++;
        if (size == deque.length) {
            enlarge();
        }
        return true;
    }

     public int removeFirst() {
        if (size == 0) {
            throw new NoSuchElementException("Trying to call removeFirst() on empty ArrayDeque");
        }
        final int removedElement = deque[head];
        size--;
        head = (head + 1) & mask;
        return removedElement;
    }

     private void enlarge() {
        int newSize = (size << 1);
        int[] newArray = new int[newSize];
        System.arraycopy(deque, head, newArray, 0, deque.length - head);
        System.arraycopy(deque, 0, newArray, deque.length - tail, tail);
        deque = newArray;
        head = 0;
        tail = size;
        mask = deque.length - 1;
    }

    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        EzIntArrayDeque that = (EzIntArrayDeque) o;

        if (size != that.size) {
            return false;
        }
        for (int i = head, j = that.head; i != tail; i = (i + 1) & mask, j = (j + 1) & that.mask) {
            if (deque[i] != that.deque[j]) {
                return false;
            }
        }
        return true;
    }

    public int hashCode() {
        int hash = HASHCODE_INITIAL_VALUE;
        for (int i = head; i != tail; i = (i + 1) & mask) {
            hash = (hash ^ PrimitiveHashCalculator.getHash(deque[i])) * HASHCODE_MULTIPLIER;
        }
        return hash;
    }

    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append('[');
        for (int i = head; i != tail; i = (i + 1) & mask) {
            if (i != head) {
                sb.append(", ");
            }
            sb.append(deque[i]);
        }
        sb.append(']');
        return sb.toString();
    }

    private class EzIntArrayDequeIterator implements EzIntIterator {
        private int curIndex = head;

        public boolean hasNext() {
            return curIndex != tail;
        }

        public int next() {
            if (curIndex == tail) {
                throw new NoSuchElementException("Iterator doesn't have more elements");
            }
            final int result = deque[curIndex];
            curIndex = (curIndex + 1) & mask;
            return result;
        }
    }
}


interface EzIntDeque extends EzIntQueue, EzIntStack {
    int size();

     EzIntIterator iterator();

     boolean equals(Object object);

    int hashCode();

    String toString();

 }


 interface EzIntList extends EzIntCollection {
    int size();

     EzIntIterator iterator();

     boolean equals(Object object);

    int hashCode();

    String toString();

 }


interface EzIntCollection {
    int size();

    EzIntIterator iterator();

    boolean equals(Object object);

    int hashCode();

    String toString();
}


 interface EzIntIterator {
    boolean hasNext();

    int next();
}

 final class PrimitiveHashCalculator {
    private PrimitiveHashCalculator() {
    }

     public static int getHash(int x) {
        return x;
    }

 }


interface EzIntQueue extends EzIntCollection {
    int size();

    EzIntIterator iterator();

    boolean equals(Object object);

    int hashCode();

    String toString();

 }


 interface EzIntStack extends EzIntCollection {
    int size();

     EzIntIterator iterator();

     boolean equals(Object object);

    int hashCode();

    String toString();

 }

