uses
    testlib, sysutils;
var
    ja, pa: integer;
    i, n, k, q, qq, j: longint;
    a: array[1..200000] of longint;

begin
    n := inf.readlongint;
    k := inf.readlongint;
    for i := 1 to n do a[i] := inf.readlongint;
       
    
    ja := ans.readlongint;
    pa := ouf.readlongint;

    j := 1;
    for i := 1 to pa do begin
      q := ouf.readlongint;
      while (j <= n) and (a[j] <> q) do begin
        inc(j);
      end;
      if j > n then begin
        quit(_wa, format('%d-th quote (%d) not found', [i, q]));
      end;
      if (i > 1) and (abs(qq - q) < k) then begin
        quit(_wa, format('quotes %d and %d cannot be adjacent', [qq, q]));
      end;
      inc(j);
      qq := q;
    end;

    if (pa < ja) then 
      quit(_wa, format('lenght is %d instead of %d', [pa, ja]));
    if (pa > ja) then 
      quit(_fail, format('lenght is %d instead of %d', [pa, ja]));     

    quit(_ok, '');
end.