#include <bits/stdc++.h>

#ifdef THEMIS
#include "testlib_themis.h"
const std::string TASK_NAME = "PICS"; 
#else
#include "testlib.h"
#endif

using namespace std;

void check() {
    // 1. Đọc dữ liệu từ file input (inf)
    int n = inf.readInt();
    int m = inf.readInt();
    vector<long long> s(n + 1);
    for (int i = 1; i <= n; ++i) s[i] = inf.readLong();

    // Đọc thông tin truy vấn của bạn thứ nhất (để kiểm tra tính hợp lệ của xâu)
    long long a1 = inf.readLong();
    long long b1 = inf.readLong();
    int lenL1 = inf.readInt();
    vector<bool> inL1(n + 1, false);
    for (int i = 0; i < lenL1; ++i) {
        int idx = inf.readInt();
        if (idx >= 1 && idx <= n) inL1[idx] = true;
    }

    // 2. Kiểm tra kết quả thí sinh cho bạn thứ nhất
    int t1_ouf = ouf.readInt();
    string s_ouf = ouf.readToken(); // Xâu '012' của thí sinh
    
    // Đọc g1 từ file đáp án (Giả định file ans chỉ có các số nguyên)
    int g1_ans = ans.readInt();

    // Kiểm tra xâu s1 của thí sinh
    if (s_ouf.length() != (size_t)n) {
        quitf(_wa, "Ban 1: Do dai xau (%d) khong khop n (%d)", (int)s_ouf.length(), n);
    }

    long long sum1 = 0, sum2 = 0;
    int count_photos = 0;
    for (int i = 0; i < n; ++i) {
        int photo_idx = i + 1;
        if (s_ouf[i] == '1') {
            if (inL1[photo_idx]) quitf(_wa, "Ban 1: Anh %d bi cam nhung van xep vao dia 1", photo_idx);
            sum1 += s[photo_idx];
            count_photos++;
        } else if (s_ouf[i] == '2') {
            if (inL1[photo_idx]) quitf(_wa, "Ban 1: Anh %d bi cam nhung van xep vao dia 2", photo_idx);
            sum2 += s[photo_idx];
            count_photos++;
        }
    }

    if (count_photos != t1_ouf) quitf(_wa, "Ban 1: So luong anh trong xau (%d) != t1 (%d)", count_photos, t1_ouf);
    if (sum1 > a1) quitf(_wa, "Ban 1: Dia 1 qua tai (%lld > %lld)", sum1, a1);
    if (sum2 > b1) quitf(_wa, "Ban 1: Dia 2 qua tai (%lld > %lld)", sum2, b1);
    
    // Điều kiện quan trọng: t1 >= g1 - 1
    if (t1_ouf < g1_ans - 1) {
        quitf(_wa, "Ban 1: Ket qua %d chua toi uu (Dap an mau: %d, yeu cau >= %d)", t1_ouf, g1_ans, g1_ans - 1);
    }

    // 3. Kiểm tra các bạn còn lại (từ 2 đến m)
    // Thí sinh in m-1 số trên 1 dòng, file ans cũng có m-1 số tương ứng
    for (int k = 2; k <= m; ++k) {
        int tk_ouf = ouf.readInt();
        int gk_ans = ans.readInt();
        if (tk_ouf < gk_ans - 1) {
            quitf(_wa, "Ban %d: Ket qua %d chua toi uu (Dap an mau: %d, yeu cau >= %d)", k, tk_ouf, gk_ans, gk_ans - 1);
        }
    }

    quitf(_ok, "Chuc mung! Tat ca %d truy van deu thoa man dieu kien (>= g_k - 1).", m);
}

int main(int argc, char *argv[]) {
#ifdef THEMIS
    registerTestlibThemis(TASK_NAME + ".inp", TASK_NAME + ".out");
#else
    registerTestlibCmd(argc, argv);
#endif
    check();
    return 0;
}