import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        // read sublist
        if (!sc.hasNextLine()) {
            System.out.println("Invalid input");
            return;
        }
        String subLine = sc.nextLine().trim();

        // read mainlist
        if (!sc.hasNextLine()) {
            System.out.println("Invalid input");
            return;
        }
        String mainLine = sc.nextLine().trim();

        String[] subParts = subLine.split(" ");
        String[] mainParts = mainLine.split(" ");

        int[] sub, main;
        try {
            sub = Arrays.stream(subParts).mapToInt(Integer::parseInt).toArray();
            main = Arrays.stream(mainParts).mapToInt(Integer::parseInt).toArray();
        } catch (Exception e) {
            System.out.println("Invalid input");
            return;
        }

        if (sub.length == 0 || main.length == 0 || sub.length > main.length) {
            System.out.println("Invalid input");
            return;
        }

        // check if ALL elements in BOTH lists are the same → print -1
        boolean allSame = true;
        int first = main[0];
        for (int x : main) {
            if (x != first) {
                allSame = false;
                break;
            }
        }
        if (allSame) {
            System.out.println(-1);
            return;
        }

        // check sublist in mainlist
        boolean found = false;
        for (int i = 0; i <= main.length - sub.length; i++) {
            boolean match = true;
            for (int j = 0; j < sub.length; j++) {
                if (main[i + j] != sub[j]) {
                    match = false;
                    break;
                }
            }
            if (match) {
                found = true;
                break;
            }
        }

        if (found) {
            System.out.println("Sublist found");
        } else {
            System.out.println("Sublist not found");
        }
    }
}
