func_code_string: #include <bits/stdc++.h>   using namespace std;   int n, k;   int arr[200005];   int brr[200005];   priority_queue<int, vector<int>, greater<int> > q;   stack<int> s;   int vis[200005];   int main() {     while (cin >> n >> k) {       while (!q.empty()) q.pop();       while (!s.empty()) s.pop();       memset(vis, 0, sizeof(vis));       int kmax = 0;       for (int i = 0; i < k; i++) {         scanf( %d , &arr[i]);         vis[arr[i]] = 1;         kmax = max(kmax, arr[i]);       }       for (int i = 1; i <= kmax; i++) {         if (vis[i] == 0) {           q.push(i);         }       }       int indexb = 0;       for (int i = 0; i < k; i++) {         if (s.empty()) {           s.push(arr[i]);         } else if (arr[i] > s.top()) {           while (!s.empty() && arr[i] > s.top()) {             brr[indexb++] = s.top();             s.pop();           }           s.push(arr[i]);         } else {           s.push(arr[i]);         }       }       bool flag = true;       for (int i = 0; i < indexb; i++) {         if (brr[i] != i + 1) flag = false;       }       if (flag == false) {         cout << -1 << endl;         continue;       }       stack<int> choosing;       for (int i = 0; i < k; i++) printf( %d%c , arr[i], i == k - 1 ?     :    );       int cnt = 0;       while (!s.empty()) {         while (!q.empty() && q.top() < s.top()) {           choosing.push(q.top());           q.pop();         }         s.pop();         while (!choosing.empty()) {           printf( %d , choosing.top());           cnt++;           if (cnt == kmax - k && kmax == n)             printf(  n );           else             printf(   );           choosing.pop();         }       }       for (int i = n; i >= kmax + 1; i--) {         printf( %d%c , i, i == kmax + 1 ?   n  :    );       }     }     return 0;   }   