#include <bits/stdc++.h>
using namespace std;
const int MIN = (int)(-1e9 - 2e5);
const int MAX = (int)(+1e9 + 2e5);
vector<int> get(int lower, int upper, int n) {
  vector<int> res(n);
  if (lower >= 0) {
    for (int i = 0; i < n; ++i) {
      res[i] = lower + 1 + i;
    }
  } else if (upper <= 0) {
    for (int i = 0; i < n; ++i) {
      res[n - 1 - i] = upper - 1 - i;
    }
  } else {
    int left = max(0, n - upper), right = min(n - 1, -lower - 1);
    int middle = (n - 1) / 2, pos;
    if (left <= middle && middle <= right) {
      pos = middle;
    } else if (right < middle) {
      pos = right;
    } else {
      pos = left;
    }
    for (int i = 0; i < n; ++i) {
      res[i] = i - pos;
    }
  }
  return res;
}
bool solve(int n, int k, vector<int>& array, vector<bool>& flag) {
  for (int i = 0; i < k; ++i) {
    for (int st = i, ed; st < n; st = ed) {
      for (ed = st + k; ed < n; ed += k) {
        if (flag[ed]) {
          break;
        }
      }
      if (ed >= n) {
        continue;
      }
      int cnt = (ed - st) / k - 1;
      if (array[ed] - array[st] - 1 < cnt) {
        return false;
      }
      vector<int> buf = get(array[st], array[ed], cnt);
      for (int j = 0; j < cnt; ++j) {
        array[st + k + j * k] = buf[j];
      }
    }
  }
  return true;
}
int main() {
  int n, k;
  cin >> n >> k;
  vector<int> array(n + 2 * k);
  vector<bool> flag(n + 2 * k);
  for (int i = 0; i < k; ++i) {
    flag[i] = true;
    array[i] = MIN;
  }
  for (int i = k; i < n + k; ++i) {
    string buf;
    cin >> buf;
    if (buf == "?") {
      flag[i] = false;
    } else {
      flag[i] = true;
      sscanf(buf.c_str(), "%d", &array[i]);
    }
  }
  for (int i = n + k; i < n + 2 * k; ++i) {
    flag[i] = true;
    array[i] = MAX;
  }
  if (solve(n + 2 * k, k, array, flag)) {
    for (int i = k; i < n + k; ++i) {
      cout << array[i] << (i == n + k - 1 ? "\n" : " ");
    }
  } else {
    cout << "Incorrect sequence" << endl;
  }
  return 0;
}
