#include <bits/stdc++.h>
using namespace std;
#pragma comment(linker, "/STACK:256000000")
template <class T>
T sqr(T a) {
  return a * a;
}
int n, m, d[1000000], x, y, dx, dy;
int root, en = 1, sz = 0, bar;
void init() {
  scanf("%d%d", &n, &m);
  for (int j = 0; j < m; ++j) {
    scanf("%d", &d[j]);
  }
}
int kar;
struct tree {
  int x, y, l, r, s;
};
tree tp[1000001];
void check(int x) {
  if (!x) return;
  tp[x].s = tp[tp[x].l].s + tp[tp[x].r].s + 1;
}
pair<int, int> split(int x, int key) {
  kar++;
  if (!x) {
    return pair<int, int>(0, 0);
  }
  if (tp[tp[x].l].s + 1 > key) {
    pair<int, int> t;
    t = split(tp[x].l, key);
    tp[x].l = t.second;
    t.second = x;
    check(x);
    return t;
  } else {
    pair<int, int> t;
    t = split(tp[x].r, key - tp[tp[x].l].s - 1);
    tp[x].r = t.first;
    t.first = x;
    check(x);
    return t;
  }
}
int merge(int x, int y) {
  if (!x || !y) {
    check(max(x, y));
    return (max(x, y));
  }
  if (tp[x].y < tp[y].y) {
    tp[y].l = merge(x, tp[y].l);
    check(y);
    return y;
  } else {
    tp[x].r = merge(tp[x].r, y);
    check(x);
    return x;
  }
}
void del() {
  int l = 0;
  while (d[l] - l <= sz && l < m) {
    pair<int, int> t = split(root, d[l] - l);
    kar = 0;
    pair<int, int> tr = split(t.first, d[l] - 1 - l);
    root = merge(tr.first, t.second);
    l++;
    sz--;
  }
}
void add(int q) {
  tp[en].x = q;
  tp[en].y = rand();
  en++;
  root = merge(root, en - 1);
  sz++;
}
void print(int x) {
  if (!x) return;
  print(tp[x].l);
  printf("%d", tp[x].x);
  bar++;
  print(tp[x].r);
}
void solve() {
  int tr = 0;
  for (int i = 0; i < n; ++i) {
    int q;
    scanf("%d", &q);
    if (q == -1) {
      del();
    } else
      add(q);
  }
  print(root);
  if (!bar) {
    puts("Poor stack!");
  }
}
int main() {
  srand(time(0));
  init();
  solve();
  return 0;
}
