#include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 5;
int arr[N];
set<pair<int, int> > st;
int bit[N];
void update(int idx, int val = 1) {
  for (; idx < N; idx += (idx & -idx)) bit[idx] += val;
}
int getAns(int idx) {
  int ans = 0;
  for (; idx; idx -= (idx & -idx)) ans += bit[idx];
  return ans;
}
void print() {
  for (auto it : st) printf("%d ", it.first);
  puts("");
}
int main() {
  int n, q;
  cin >> q >> n;
  for (int i = 1; i <= n; ++i) scanf("%d", &arr[i]);
  arr[0] = 0;
  for (int i = 1, k = 1; i <= q; ++i) {
    int x;
    scanf("%d", &x);
    if (x == 0) {
      update(k);
      st.insert({k++, 0});
    } else if (x == 1) {
      update(k);
      st.insert({k++, 1});
    } else {
      int l = 0, r = n;
      int m = st.size();
      while (l < r) {
        int mid = l + (r - l + 1) / 2;
        if (m >= arr[mid])
          l = mid;
        else
          r = mid - 1;
      }
      vector<int> vec;
      for (int j = 1; j <= l; ++j) {
        int st = 1, en = k - 1;
        while (st < en) {
          int mid = st + (en - st) / 2;
          if (getAns(mid) >= arr[j])
            en = mid;
          else
            st = mid + 1;
        }
        vec.push_back(st);
      }
      for (auto a : vec) {
        update(a, -1);
        st.erase(st.lower_bound({a, -1}));
      }
    }
  }
  if (st.empty())
    cout << "Poor stack!" << endl;
  else {
    for (auto it : st) printf("%d", it.second);
  }
  return 0;
}
