#include <bits/stdc++.h>
using namespace std;
long long q[2 * 100010];
int head, tail;
vector<int> b;
long long a[100010];
int n, k;
int main() {
  cin >> n >> k;
  for (int i = 0; i < n; i++) {
    char s[12];
    scanf("%s", s);
    if (s[0] == '?')
      a[i] = 1e18;
    else if (s[0] == '-') {
      a[i] = 0;
      for (int j = 1; j < strlen(s); j++) a[i] = a[i] * 10 - (s[j] - '0');
    } else {
      a[i] = 0;
      for (int j = 0; j < strlen(s); j++) a[i] = a[i] * 10 + (s[j] - '0');
    }
  }
  for (int i = 0; i < n; i++) {
    if (a[i] == 1e18) {
      long long down, up;
      b.clear();
      int j = i;
      b.push_back(i);
      while (j + k < n && a[j + k] == 1e18) {
        b.push_back(j + k);
        j += k;
      }
      if (i - k >= 0)
        down = a[i - k];
      else
        down = -1e18;
      if (j + k < n)
        up = a[j + k];
      else
        up = 1e18;
      head = tail = 0;
      for (int p = -b.size() + 1; p <= 0; p++) q[tail++] = p;
      while (abs(q[head]) > q[tail - 1] + 1) {
        head++;
        q[tail] = q[tail - 1] + 1;
        tail++;
      }
      if (down >= q[head]) {
        for (int p = 0; p < b.size(); p++) a[b[p]] = down + p + 1;
      } else if (up <= q[tail - 1]) {
        for (int p = 0; p < b.size(); p++)
          a[b[p]] = (long long)(up - b.size() + p);
      } else {
        for (int p = 0; p < b.size(); p++) a[b[p]] = q[p + head];
      }
    }
  }
  int flag = 1;
  for (int i = 0; i < n; i++) {
    if (i + k < n && a[i + k] <= a[i]) {
      flag = 0;
      break;
    }
  }
  if (flag) {
    printf("%d", a[0]);
    for (int i = 1; i < n; i++) printf(" %d", a[i]);
    printf("\n");
  } else
    printf("Incorrect sequence\n");
  return 0;
}
