#include <bits/stdc++.h>
using namespace std;
int n, k, a[100005], len;
char s[10000005];
struct el {
  int val, poz;
} v[100005];
inline int Nr(int &poz) {
  int x = 0, sign = 1;
  if (s[poz] == '-') {
    sign = -1;
    ++poz;
  }
  for (; poz <= len && s[poz] >= '0' && s[poz] <= '9';
       x = x * 10 + s[poz++] - '0')
    ;
  return x * sign;
}
int main() {
  int poz = 1, i, prec, j, val, l;
  cin >> n >> k;
  cin.get();
  cin.getline(s + 1, 10000000);
  n = 0;
  len = strlen(s + 1);
  while (poz <= len) {
    if (s[poz] == '?') {
      a[++n] = 2000000001;
      poz += 2;
    } else {
      a[++n] = Nr(poz);
      ++poz;
    }
  }
  a[0] = -2000000001;
  for (poz = 1; poz <= k; ++poz) {
    l = 0;
    for (i = poz; i <= n; i += k) {
      el w;
      w.poz = i;
      w.val = a[i];
      v[++l] = w;
    }
    v[0].val = -2000000001;
    prec = 0;
    for (i = 1; i <= l; ++i) {
      if (v[i].val != 2000000001) {
        if (1LL * v[i].val - v[prec].val - 1 < i - prec - 1) {
          cout << "Incorrect sequence\n";
          return 0;
        }
        if (v[prec].val >= 0)
          for (j = prec + 1; j < i; ++j) a[v[j].poz] = v[prec].val + j - prec;
        else {
          if (i - 1 > prec) {
            a[v[i - 1].poz] = min(((i - prec - 1) / 2), v[i].val - 1);
            a[v[i - 1].poz] = max(a[v[i - 1].poz], v[prec].val + i - prec - 1);
          }
          for (j = i - 2; j > prec; --j) a[v[j].poz] = a[v[j + 1].poz] - 1;
        }
        prec = i;
      }
    }
    if (v[l].val == 2000000001) {
      if (prec + 1 <= l)
        a[v[prec + 1].poz] = max(-(l - prec) / 2, v[prec].val + 1);
      for (j = prec + 2; j <= l; ++j) a[v[j].poz] = a[v[j - 1].poz] + 1;
    }
  }
  for (i = 1; i <= n; ++i) cout << a[i] << " ";
  return 0;
}
