#include <bits/stdc++.h>
using namespace std;
const int M = (1 << 30);
const int N = 1e6 + 5;
int nx[N];
int a[N];
int s[N];
int main() {
  int n, m;
  cin >> n >> m;
  for (int i = 0; i < m; i++) scanf("%d", &a[i]);
  int p = 0, pr, tl = 1;
  int nn = n;
  while (n--) {
    int x;
    scanf("%d", &x);
    if (x == -1) {
      int k = 0, y = 0, nxt;
      pr = 1;
      while (pr <= p && k < m) {
        nxt = nx[pr];
        if (s[pr] != -1) {
          y += nxt - pr + 1;
          if (y >= a[k]) {
            int z = pr + (nxt - pr + 1 - (y - a[k])) - 1;
            if (z - 1 >= pr) nx[pr] = z - 1;
            nx[z] = z;
            if (nxt >= z + 1) nx[z + 1] = nxt;
            s[z] = -1;
            k++;
            if (nxt == p) tl = z + 1;
            y -= nxt - z;
            pr = z + 1;
            continue;
          }
          pr = nxt + 1;
        } else {
          if (nxt + 1 <= p) {
            if (s[nxt + 1] == -1) {
              nx[pr] = nx[nxt + 1];
              nxt = nx[nxt + 1];
            } else {
              pr = nxt + 1;
            }
          } else {
            pr = nxt + 1;
            tl = nxt + 1;
          }
        }
      }
    } else {
      s[++p] = x;
      nx[tl] = p;
    }
  }
  pr = 1;
  int est = 0;
  while (pr <= p) {
    int nxt = nx[pr];
    if (s[pr] != -1) {
      est = 1;
      for (int i = pr; i <= nxt; i++) printf("%d", s[i]);
    }
    pr = nxt + 1;
  }
  if (!est) cout << "Poor stack!\n";
}
