program checkf;

uses
    testlib, sysutils;

var
    i, j, n, t: longint;
    ja, pa: longint;
    a, b: array [0..201] of longint;

begin
    ja := ans.readlongint;
    pa := ouf.readlongint;
    
    if ja <> pa then
        quit(_wa, 'number of apples - expected: ' + inttostr(ja) + 
            ', found: ' + inttostr(pa));

    for i := 1 to pa do
    begin
        a[i] := ouf.readlongint;
    end;
    
    for i := 1 to pa - 1 do
        for j := i + 1 to pa do
            if a[i] > a[j] then
            begin
                t := a[i]; a[i] := a[j]; a[j] := t;
            end;

    for i := 1 to ja do
    begin
        b[i] := ans.readlongint;
    end;

    for i := 1 to pa - 1 do
        for j := i + 1 to pa do
            if b[i] > b[j] then
            begin
                t := b[i]; b[i] := b[j]; b[j] := t;
            end;
            
    for i := 1 to ja do
        if a[i] <> b[i] then
        begin
            if (i > 1) and (a[i] = a[i - 1]) then
                quit(_wa, 'duplicate apple: ' + inttostr(a[i]));
            if a[i] > b[i] then
                quit(_wa, 'missing apple: ' + inttostr(b[i]));
            quit(_wa, 'unexpected apple: ' + inttostr(a[i]));
        end;
        
    n := inf.readlongint;
    quit(_ok, inttostr(ja) + ' of ' + inttostr(n));
end.