#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 10;
const int M = 110;
const int INF = 1e9 + 1e6;
bool vis[N];
int a[N], b[N];
void add(int *a, int n, int L, int R) {
  if (R - L <= n) return;
  if (L >= 0) {
    for (int i = 0; i < n; i++) a[i] = ++L;
  } else if (R <= 0) {
    for (int i = n - 1; i >= 0; i--) a[i] = --R;
  } else {
    int t = n / 2, f = 0, l = -INF;
    for (int i = t; i >= 0; i--)
      if (L < -i && n - i - 1 < R) {
        l = -i;
        f = 1;
        break;
      }
    for (int i = t; i < n && !f; i++)
      if (L < -i && n - i - 1 < R) {
        l = -i;
        f = 1;
        break;
      }
    for (int i = 0; i < n; i++) a[i] = l++;
  }
}
void read(int i) {
  int x = 0, f = 1;
  char ch = getchar();
  while ((ch < '0' || ch > '9') && (ch != '-') && (ch != '?')) ch = getchar();
  if (ch == '?') vis[i] = 1;
  if (ch == '-') f = -1, ch = getchar();
  while (ch >= '0' && ch <= '9') x = x * 10 + ch - '0', ch = getchar();
  a[i] = f * x;
}
int main() {
  int n, k;
  scanf("%d %d", &n, &k);
  memset(vis, 0, sizeof(vis));
  for (int i = 0; i < n; i++) read(i);
  int F = 1;
  for (int i = 0; i < k; i++) {
    int p = 0, f = 0, tp = 0;
    for (int j = i; j < n; j += k, tp++) {
      if (vis[j]) {
        if (!f) p = tp;
        f = 1;
      } else {
        if (f) {
          if (p == 0)
            add(b + p, tp - p, -INF, a[j]);
          else
            add(b + p, tp - p, b[p - 1], a[j]);
        }
        f = 0;
      }
      b[tp] = a[j];
    }
    if (f) {
      if (p == 0)
        add(b + p, tp - p, -INF, INF);
      else
        add(b + p, tp - p, b[p - 1], INF);
    }
    for (int j = 1; j < tp; j++)
      if (b[j] <= b[j - 1]) {
        F = 0;
        break;
      }
    tp = 0;
    for (int j = i; j < n; j += k, tp++) a[j] = b[tp];
  }
  if (!F)
    printf("Incorrect sequence\n");
  else {
    for (int i = 0; i < n; i++) printf("%d ", a[i]);
    puts("");
  }
  return 0;
}
