#include <bits/stdc++.h>
using namespace std;
const int inf = 0x3f3f3f3f;
const long long INF = 0x3f3f3f3f3f3f3f3f;
const int N = 1e5 + 7;
const int M = 12;
long long n, k, a[N], l[N], r[N], sum;
char s[20];
bool flag[N];
vector<long long> v[N];
void solve(int o) {
  int len = strlen(s);
  if (s[0] == '?')
    a[o] = INF;
  else if (s[0] == '-') {
    long long ans = 0;
    for (int i = 1; i < len; i++) ans *= 10, ans += s[i] - '0';
    a[o] = -ans;
  } else {
    long long ans = 0;
    for (int i = 0; i < len; i++) ans *= 10, ans += s[i] - '0';
    a[o] = ans;
  }
}
bool cal() {
  for (int u = 0; u < k; u++) {
    v[u].push_back(INF - 1);
    int sz = v[u].size();
    if (!sz) continue;
    long long l = -INF, r = INF, cnt = 0;
    for (int i = 0; i < sz; i++) {
      if (v[u][i] != INF) {
        r = v[u][i] - 1;
        if (cnt > r - l + 1) return false;
        if (l >= 0) {
          int pos = i - cnt;
          for (int j = l; j < l + cnt; j++) v[u][pos++] = j;
        } else if (r <= 0) {
          int pos = i - 1;
          for (int j = r; j > r - cnt; j--) v[u][pos--] = j;
        } else {
          vector<long long> vec;
          long long num = cnt;
          if (num) vec.push_back(0 * 1ll), num--;
          long long L = -1, R = 1;
          while (num > 0) {
            if (L >= l && num > 0) vec.push_back(L), L--, num--;
            if (R <= r && num > 0) vec.push_back(R), R++, num--;
          }
          sort(vec.begin(), vec.end());
          int pos = i - cnt;
          for (int j = 0; j < vec.size(); j++) v[u][pos++] = vec[j];
        }
        cnt = 0;
        l = v[u][i] + 1;
        r = INF;
      } else
        cnt++;
    }
  }
  return true;
}
int main() {
  scanf("%lld", &n);
  scanf("%lld", &k);
  sum = 0;
  for (int i = 0; i < n; i++) {
    scanf("%s", s);
    solve(i);
    if (a[i] != INF) sum += abs(a[i]);
  }
  for (int i = 0; i < n; i++) v[i % k].push_back(a[i]);
  if (!cal())
    puts("Incorrect sequence");
  else {
    int ret = n;
    for (int j = 0; ret; j++)
      for (int i = 0; i < k && ret; i++) printf("%lld ", v[i][j]), ret--;
    puts("");
  }
  return 0;
}
