#include <bits/stdc++.h>
using namespace std;
const int M = 6 * 1e5;
const int Q = 1e9 + 7 + 500000;
void fin() {
  puts("Incorrect sequence");
  exit(0);
}
int a[M];
int go(string s) {
  int res = 0, l = 0, tq = 0;
  if (s[0] == '-') l = 1, tq = 1;
  for (int i = tq; i < (int)s.size(); i++) res = res * 10 + s[i] - '0';
  if (l) return -res;
  return res;
}
int main() {
  srand(time(NULL));
  int k, n;
  cin >> n >> k;
  for (int i = 0; i < n; i++) {
    string s;
    cin >> s;
    if (s == "?")
      a[i] = Q;
    else
      a[i] = go(s);
  }
  for (int kk = 0; kk < k; kk++) {
    vector<int> g;
    g.push_back(-Q);
    for (int i = kk; i < n; i += k) g.push_back(a[i]);
    g.push_back(Q);
    int i = 0;
    while (i < (int)g.size() - 1) {
      int j = i + 1;
      while (j < (int)g.size() - 1 && abs(g[j]) > 1e9) j++;
      int aa = g[i], bb = g[j], h = j - i - 1;
      int t = (bb - (h - 1) - (aa + 1));
      if (aa >= bb || (h && t < 1)) fin();
      int pos = aa + 1 + h / 2;
      if (pos < 0) aa += (min(pos + t - 1, 0) - pos);
      for (int kkk = i + 1; kkk < j; kkk++)
        a[kk + (kkk - 1) * k] = aa + 1 + (kkk - (i + 1));
      i = j;
    }
  }
  for (int i = 0; i < n; i++) printf("%d ", a[i]);
  return 0;
}
