#include <bits/stdc++.h>
using namespace std;
int a[100005], k, n;
bool ques[100005];
int toInt(char *s) {
  int num = 0;
  bool fu = 0;
  if (s[0] == '-') fu = 1, s++;
  int l = strlen(s), i;
  for (i = 0; i < l; i++) {
    num = num * 10 + s[i] - '0';
  }
  return fu ? (-num) : num;
}
bool flag;
int dfs(int len, int loc, int mn) {
  if (loc > n) {
    return len / 2;
  }
  if (ques[loc]) {
    int tmp = dfs(len + 1, loc + k, mn + 1);
    ques[loc] = 0;
    a[loc] = max(mn, tmp);
    return a[loc] - 1;
  } else {
    return min(len / 2, a[loc] - 1);
  }
}
int main() {
  scanf("%d%d", &n, &k);
  int i;
  for (i = 1; i <= n; i++) {
    char tmp[15];
    scanf("%s", tmp);
    if (tmp[0] == '?')
      ques[i] = 1;
    else {
      a[i] = toInt(tmp);
    }
  }
  for (i = 1; i <= n; i++) {
    if (!ques[i]) continue;
    if (i - k >= 1)
      dfs(0, i, a[i - k] + 1);
    else
      dfs(0, i, -2000000050);
  }
  for (i = 1; i + k <= n; i++) {
    if (a[i] >= a[i + k]) {
      flag = 1;
      break;
    }
  }
  if (flag)
    puts("Incorrect sequence");
  else
    for (i = 1; i <= n; i++) {
      printf("%d ", a[i]);
    }
  return 0;
}
