#include <bits/stdc++.h>

using namespace std;
using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;
constexpr ll TEN(int n) { return (n==0) ? 1 : 10*TEN(n-1); }
template<class T> using V = vector<T>;
template<class T> using VV = V<V<T>>;

 using D = double;
const D PI = acos(D(-1)), EPS = 1e-10;

int sgn(D a) { return (abs(a) <= EPS) ? 0 : (a < 0 ? -1 : 1); }
int sgn(D a, D b) { return sgn(a-b); }
//relative sign
// int rsgn(D a, D f) {
//     if (abs(a) <= f*EPS) return 0;
//     return (a < 0) ? -1 : 1;
// }
struct Pt2 {
    D x, y;
    Pt2() {}
    Pt2(D _x, D _y) : x(_x), y(_y) {}
    Pt2 operator+(const Pt2 &r) const { return Pt2(x+r.x, y+r.y); }
    Pt2 operator-(const Pt2 &r) const { return Pt2(x-r.x, y-r.y); }
    Pt2 operator*(const Pt2 &r) const { return Pt2(x*r.x-y*r.y, x*r.y+y*r.x); }

    Pt2 operator*(const D &r) const { return Pt2(x*r, y*r); }
    Pt2 operator/(const D &r) const { return Pt2(x/r, y/r); }

    Pt2& operator+=(const Pt2 &r) { return *this=*this+r; }
    Pt2& operator-=(const Pt2 &r) { return *this=*this-r; }
    Pt2& operator*=(const Pt2 &r) { return *this=*this*r; }
    Pt2& operator*=(const D &r) { return *this=*this*r; }
    Pt2& operator/=(const D &r) { return *this=*this/r; }
    
    Pt2 operator-() const { return Pt2(-x, -y); }

    bool operator<(const Pt2 &r) const { return 2*sgn(x, r.x)+sgn(y, r.y)<0; }
    bool operator==(const Pt2 &r) const { return sgn((*this-r).rabs()) == 0; }

    D norm() const { return x*x + y*y; }
    D abs() const { return sqrt(norm()); }
    D rabs() const { return max(std::abs(x), std::abs(y)); } // robust abs
    D arg() const { return atan2(y, x); }

    pair<D, D> to_pair() const { return make_pair(x, y); }
    static Pt2 polar(D le, D th) { return Pt2(le*cos(th), le*sin(th)); }
};
ostream& operator<<(ostream& os, const Pt2 &p) {
    return os << "P(" << p.x << ", " << p.y << ")";
}
using P = Pt2;

struct L {
    P s, t;
    L() {}
    L(P _s, P _t) : s(_s), t(_t) {}
    P vec() const { return t-s; }
    D abs() const { return vec().abs(); }
    D arg() const { return vec().arg(); }
};
ostream& operator<<(ostream& os, const L &l) {
    return os << "L(" << l.s << ", " << l.t << ")";
}
using Pol = V<P>;

D cross(P a, P b) { return a.x*b.y - a.y*b.x; }
D dot(P a, P b) { return a.x*b.x + a.y*b.y; }

struct C {
    P p; D r;
    C() {}
    C(P _p, D _r) : p(_p), r(_r) {}
};

C circumCircle(P a, P b, P c) {
    b -= a; c -= a;
    D s = 2*cross(b, c);
    D x = (b-c).norm(), y = c.norm(), z = b.norm();
    D S = x+y+z;
    P r = (b*(S-2*y)*y+c*z*(S-2*z))/(s*s);
    return C(r + a, r.abs());
}

C smallest_circle(const Pol &p, int i, array<P, 3> q, int j) {
    if (i == int(p.size())) {
        switch (j) {
            case 0:
                return C(P(0, 0), -1);
            case 1:
                return C(q[0], 0);
            case 2:
                return C((q[0]+q[1])/D(2.0), (q[0]-q[1]).abs()/D(2.0));
            case 3:
                return circumCircle(q[0], q[1], q[2]);
        }
        assert(false);
    }
    C c = smallest_circle(p, i+1, q, j);
    if (sgn((p[i]-c.p).abs(), c.r) == 1) {
        q[j] = p[i];
        return smallest_circle(p, i+1, q, j+1);
    }
    return c;
}
C smallest_circle(Pol p) {
    random_shuffle(begin(p), end(p));
    return smallest_circle(p, 0, array<P, 3>(), 0);
}


int main() {
    int n, m;
    cin >> n >> m;
    V<D> r(n), d(m);
    for (int i = 0; i < n; i++) {
        cin >> r[i];
    }
    for (int i = 0; i < m; i++) {
        int q; cin >> q;
        Pol p;
        for (int j = 0; j < q; j++) {
            D x, y;
            cin >> x >> y;
            p.push_back(P(x, y));
        }
        d[i] = smallest_circle(p).r;
        //printf("%Lf\n", d[i]);
    }
    
    auto solve = [&](){
        V<D> v1, v2;
        for (int i = 0; i < n; i++) {
            if (r[i] >= 0) v1.push_back(r[i]);
        }
        for (int i = 0; i < m; i++) {
            if (d[i] >= 0) v2.push_back(d[i]);
        }
        sort(v1.begin(), v1.end());
        sort(v2.begin(), v2.end());
        int j = 0;
        for (int i = 0; i < (int)v2.size(); i++) {
            while (j < (int)v1.size() && v1[j] < v2[i]) j++;//sgn?
            j++;
        }
        return (j <= (int)v1.size());
    };

    V<int> res;
    for (int i = 0; i < m; i++) {
        D dd = d[i];
        d[i] = -1;
        for (int j = 0; j < n; j++) {
            if (r[j] < dd) continue;
            D rr = r[j];
            r[j] = -1;
            if (solve()) {
                res.push_back(j);
                break;
            }
            r[j] = rr;
        }
    }
    if (int(res.size()) != m) {
        cout << "NG" << endl;
        return 0;
    }
    for (int dd: res) {
        cout << dd+1 << endl;
    }
    return 0;
}



Measured memory_bytes: 3284