#include <bits/stdc++.h>
using namespace std;
int n, k;
int mark[111111 << 2], num[4 * 111111], add;
char str[11];
int getnum(char str[]) {
  int ret = 0, neg = -1, i = 1;
  if (str[0] != '-') neg = 1, i = 0;
  for (; str[i]; i++) {
    ret = ret * 10 + str[i] - '0';
  }
  ret *= neg;
  return ret;
}
void init() {
  for (int i = 1; i <= add; i++) {
    num[i] = -1010000000 + i;
    num[add + n + i] = 1010000000 + i;
  }
}
int main() {
  scanf("%d%d", &n, &k);
  add = k;
  for (int i = 1; i <= n; i++) {
    scanf("%s", str);
    if (str[0] == '?') {
      mark[i + add] = 1;
    } else {
      num[i + add] = getnum(str);
    }
  }
  init();
  int flag = 0;
  for (int i = 1; i <= k; i++) {
    if (flag) break;
    int negid = -1, posid = -1;
    int lastval = num[i];
    for (int j = i + k; j <= n + 2 * add; j += k) {
      if (mark[j]) continue;
      if (num[j] <= lastval) {
        flag = 1;
        break;
      }
      lastval = num[j];
    }
    if (flag) break;
    for (int j = i; j <= n + 2 * add; j += k) {
      if (posid == -1 && !mark[j] && num[j] >= 0) {
        posid = j;
        break;
      }
    }
    for (int j = posid; j >= 1; j -= k) {
      if (negid == -1 && !mark[j] && num[j] < 0) {
        negid = j;
        break;
      }
    }
    for (int j = posid + k; j <= n + 2 * add; j += k) {
      int lastid = j - k;
      if (!mark[j]) {
        if (num[lastid] >= num[j]) flag = 1;
        continue;
      }
      if (flag) break;
      mark[j] = 0;
      num[j] = num[lastid] + 1;
    }
    if (flag) break;
    for (int j = negid - k; j >= 1; j -= k) {
      int lastid = j + k;
      if (!mark[j]) {
        if (num[j] >= num[lastid]) flag = 1;
        continue;
      }
      if (flag) break;
      mark[j] = 0;
      num[j] = num[lastid] - 1;
    }
    int midlen = (posid - negid) / k - 1;
    if (midlen > num[posid] - num[negid]) {
      flag = 1;
      break;
    }
    int left = -((midlen - 1) / 2);
    int right = (midlen) / 2;
    if (num[posid] <= right) {
      int dis = right - num[posid] + 1;
      right -= dis;
      left -= dis;
    }
    if (num[negid] >= left) {
      int dis = num[negid] - left + 1;
      right += dis;
      left += dis;
    }
    for (int j = negid + k; j < posid; j += k) {
      num[j] = left;
      left += 1;
    }
  }
  if (flag)
    puts("Incorrect sequence");
  else {
    for (int i = k + 1; i <= k + n; i++) {
      printf("%d ", num[i]);
    }
    puts("");
  }
  return 0;
}
