#include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 10;
int c[N], a[N], ans[N], top, as[N];
int n, m, sum;
void init() {
  memset(c, 0, sizeof(c));
  memset(a, 0, sizeof(a));
  memset(ans, -1, sizeof(ans));
  top = 0;
}
int lowbit(int x) { return x & (-x); }
void add(int x, int val) {
  while (x <= m) {
    c[x] += val;
    x += lowbit(x);
  }
}
int getsum(int x) {
  int ans = 0;
  while (x) {
    ans += c[x];
    x -= lowbit(x);
  }
  return ans;
}
void work(int num, int ct) {
  int l = 1, r = m;
  while (l < r) {
    int mid = (l + r) / 2;
    if (getsum(mid) >= num)
      r = mid;
    else
      l = mid + 1;
  }
  as[ct] = l;
}
int t;
int main() {
  while (~scanf("%d%d", &m, &n)) {
    init();
    for (int i = 1; i <= n; i++) {
      scanf("%d", &a[i]);
    }
    for (int i = 1; i <= m; i++) {
      scanf("%d", &t);
      if (t == 0 || t == 1) {
        ans[++top] = t;
        sum++;
        add(top, 1);
      } else {
        int temp = lower_bound(a + 1, a + n + 1, sum) - a;
        if (temp > n)
          temp--;
        else if (a[temp] > sum)
          temp--;
        sum -= temp;
        for (int i = 1; i <= temp; i++) work(a[i], i);
        for (int i = 1; i <= temp; i++) {
          add(as[i], -1);
          ans[as[i]] = -1;
        }
      }
    }
    bool flag = false;
    for (int i = 1; i <= m; i++) {
      if (ans[i] == -1) continue;
      printf("%d", ans[i]);
      flag = true;
    }
    if (!flag) printf("Poor stack!");
    puts("");
  }
}
