#include <iostream>
#include <cassert>
#include <vector>
#include <set>
#include <queue>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <complex>
#include <cmath>

using namespace std;
typedef long long ll;

typedef long double R;
typedef complex<R> P;

namespace std {
    bool operator < (P a, P b) {
        return real(a) != real(b) ? real(a) < real(b) : imag(a) < imag(b);
    }
    bool operator > (P a, P b) {
        return (b < a);
    }
}

const R EPS = 1e-10;
const R PI = acos((R)(-1));

/*
 -1 -> neg
  0 -> near 0
  1 -> pos
  */
int sgn(R a) {
    if (a < -EPS) return -1;
    if (a > EPS) return 1;
    return 0;
}

int sgn(R a, R b) {
    return sgn(b-a);
}

bool near(P a, P b) {
    return !sgn(abs(a-b));
}

R cross(P a, P b) { return imag(conj(a)*b); }
R dot(P a, P b) { return real(conj(a)*b); }

struct C {
    P p;
    R r;
    C() {}
    C(P p, R r) : p(p), r(r) {}
};

struct T {
    P d[3];
    T() {}
    T(P x, P y, P z) {
        d[0] = x; d[1] = y; d[2] = z;
    }
};

typedef vector<P> Pol;

C circumCircle(T t) {
    P a = t.d[0], b = t.d[1], c = t.d[2];
    b -= a; c -= a;
    R s = 2*cross(b, c);
    R x = norm(b-c), y = norm(c), z = norm(b);
    R S = x+y+z;
    P r = (y*(S-2*y)*b+z*(S-2*z)*c)/(s*s);
    return C(r + a, abs(r));
}

C smallestEnclosingCircle(Pol &p, int ps, T q = T(), int qs = 0) {
    if (!ps) {
        switch (qs) {
            case 0:
                return C(P(0, 0), -1);
            case 1:
                return C(q.d[0], 0);
            case 2:
                return C((q.d[0]+q.d[1])/R(2.0), abs(q.d[0]-q.d[1])/R(2.0));
            case 3:
                return circumCircle(q);
        }
        assert(false);
    }
    C c = smallestEnclosingCircle(p, ps-1, q, qs);
    if (sgn(c.r, abs(p[ps-1]-c.p)) == 1) {
        q.d[qs] = p[ps-1];
        return smallestEnclosingCircle(p, ps-1, q, qs+1);
    }
    return c;
}


const int MN = 110;
int n, m;
R r[MN];
R d[MN];

bool solve() {
    vector<R> 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());
}

int main() {
    cin >> n >> 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++) {
            R x, y;
            cin >> x >> y;
            p.push_back(P(x, y));
        }
        d[i] = smallestEnclosingCircle(p, p.size()).r;
        //printf("%Lf\n", d[i]);
    }
    vector<int> res;
    for (int i = 0; i < m; i++) {
        R dd = d[i];
        d[i] = -1;
        for (int j = 0; j < n; j++) {
            if (r[j] < dd) continue;
            R 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: 1320