func_code_string: #include <bits/stdc++.h>   using namespace std;   long long n, k, a[100010], w[100010];   int main() {     while (~scanf( %lld%lld , &n, &k)) {       for (long long i = 1; i <= n; i++) scanf( %lld , &a[i]);       memset(w, -1, sizeof(w));       for (long long i = 1; i <= n; i++)         if (w[a[i]] == -1) {           long long tmp = 256;           for (long long j = a[i] - k + 1; j <= a[i]; j++) {             if (j < 0) continue;             if (w[j] == -1 || w[j] == j) {               tmp = j;               break;             }           }           for (long long k = tmp; k <= a[i]; k++) w[k] = tmp;         }       for (long long i = 1; i <= n; i++) printf( %lld  , w[a[i]]);       printf(  n );     }     return 0;   }   