#include <bits/stdc++.h>
using namespace std;
vector<long long> v[2][100005];
int a[100005], cnt[100005];
int main() {
  int n, k, i, j, x, bg;
  while (cin >> n >> k) {
    string s;
    for (i = 0; i < n; i++) {
      v[0][i].push_back(-1100000000LL);
      v[1][i].push_back(0);
    }
    for (i = 0; i < n; i++) {
      cin >> s;
      if (s == "?")
        v[1][i % k][v[1][i % k].size() - 1]++;
      else {
        a[i] = atoi(s.c_str());
        v[0][i % k].push_back((long long)a[i]);
        v[1][i % k].push_back(0);
      }
    }
    for (i = 0; i < n; i++) v[0][i].push_back(1100000000LL);
    int f = 0;
    for (i = 0; i < k; i++) {
      int tmp = 0;
      for (j = 0; j < v[0][i].size() - 1; j++) {
        if (v[0][i][j + 1] - v[0][i][j] - 1 < v[1][i][j]) {
          f = 1;
          break;
        }
        tmp++;
        if (v[0][i][j] >= 0)
          bg = v[0][i][j] + 1;
        else if (v[0][i][j + 1] <= 0)
          bg = v[0][i][j + 1] - v[1][i][j];
        else {
          if (2 * min(abs(v[0][i][j]), abs(v[0][i][j + 1])) - 1 >= v[1][i][j])
            bg = -(v[1][i][j] - 1) / 2;
          else if (abs(v[0][i][j]) < abs(v[0][i][j + 1]))
            bg = v[0][i][j] + 1;
          else
            bg = v[0][i][j + 1] - v[1][i][j];
        }
        for (x = tmp; x < tmp + v[1][i][j]; x++) {
          a[i + (x - 1) * k] = bg++;
        }
        tmp += v[1][i][j];
      }
    }
    if (f)
      cout << "Incorrect sequence" << endl;
    else {
      for (i = 0; i < n; i++) {
        cout << a[i];
        if (i < n - 1)
          cout << " ";
        else
          cout << endl;
      }
    }
  }
  return 0;
}
