import java.util.*;

public class SublistCheck {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        try {
            // Read sublist
            String subInput = sc.nextLine().trim();
            String[] subArr = subInput.split("\\s+");
            List<Integer> sublist = new ArrayList<>();
            for (String s : subArr) {
                sublist.add(Integer.parseInt(s));
            }

            // Read main list
            String mainInput = sc.nextLine().trim();
            String[] mainArr = mainInput.split("\\s+");
            List<Integer> mainlist = new ArrayList<>();
            for (String s : mainArr) {
                mainlist.add(Integer.parseInt(s));
            }

            // If all elements in the main list are the same → print -1
            if (allSame(mainlist)) {
                System.out.println("-1");
                return;
            }

            // Check if sublist exists inside mainlist
            if (isSublist(sublist, mainlist)) {
                System.out.println("Sublist found");
            } else {
                System.out.println("Sublist not found");
            }

        } catch (Exception e) {
            System.out.println("Invalid input");
        }
    }

    // Helper: check if all elements in a list are the same
    private static boolean allSame(List<Integer> list) {
        for (int i = 1; i < list.size(); i++) {
            if (!list.get(i).equals(list.get(0))) {
                return false;
            }
        }
        return true;
    }

    // Helper: check if sublist appears contiguously in mainlist
    private static boolean isSublist(List<Integer> sublist, List<Integer> mainlist) {
        int n = sublist.size();
        int m = mainlist.size();

        for (int i = 0; i <= m - n; i++) {
            boolean match = true;
            for (int j = 0; j < n; j++) {
                if (!mainlist.get(i + j).equals(sublist.get(j))) {
                    match = false;
                    break;
                }
            }
            if (match) return true;
        }
        return false;
    }
}
