func_code_string: #include <bits/stdc++.h>   const int inf = 1 << 30;   const long long INF = 1ll << 61;   using namespace std;   int n, m;   int c[1000000 + 55];   int nnum[1000000 + 55];   int aa[1000000 + 55];   int sum[1000000 + 55];   int len;   void init() {     memset(c, 0, sizeof(c));     memset(aa, -1, sizeof(aa));   }   bool input() {     while (cin >> n >> m) {       for (int i = 0; i < m; i++) cin >> nnum[i];       return false;     }     return true;   }   int lowbit(int x) { return x & (-x); }   void add(int i, int val) {     while (i <= n) {       c[i] += val;       i += lowbit(i);     }   }   int get_sum(int i) {     int sum = 0;     while (i > 0) {       sum += c[i];       i -= lowbit(i);     }     return sum;   }   void binary_find(int pos) {     for (int i = 0; i <= pos; i++) {       int l = 1;       int r = n;       while (l <= r) {         int mid = (l + r) >> 1;         int ret = get_sum(mid);         if (aa[mid] == -1) {           if (ret >= nnum[i] - i)             r = mid - 1;           else             l = mid + 1;         } else if (ret == nnum[i] - i) {           add(mid, -1);           aa[mid] = -1;           len--;           break;         } else if (ret > nnum[i] - i)           r = mid - 1;         else if (ret < nnum[i] - i)           l = mid + 1;       }     }   }   void cal() {     int q = n;     len = 0;     int cnt = 1;     while (q--) {       int type;       cin >> type;       if (type == -1) {         if (len == 0) continue;         if (nnum[0] > len) continue;         int now = lower_bound(nnum, nnum + m, len) - nnum;         binary_find(now);       } else {         aa[cnt] = type;         add(cnt, 1);         cnt++;         len++;       }     }     if (len <= 0) {       puts( Poor stack! );       return;     }     for (int i = 1; i <= n; i++)       if (aa[i] != -1) printf( %d , aa[i]);     puts(  );   }   void output() {}   int main() {     while (true) {       init();       if (input()) return 0;       cal();       output();     }     return 0;   }   