import java.io.*;
import java.util.*;

public class kabaleo_t4 {

    static void solve() throws IOException {
        int n = nextInt();
        int p = nextInt();
        int c = nextInt();
        int h = nextInt() - 1;
        int[] b = new int[n];
        for (int i = 0; i < n; i++) {
            b[i] = nextInt() - 1;
        }
        int[] a = new int[p];
        for (int i = 0; i < p; i++) {
            a[i] = nextInt() - 1;
        }
        int[] next = new int[p];
        int[] first = new int[c];
        Arrays.fill(first, p);
        for (int i = p - 1; i >= 1; i--) {
            next[i] = first[a[i]];
            first[a[i]] = i;
        }
        int[] count = new int[c];
        for (int i : b) {
            count[i]++;
        }
        int[] countOur = new int[p];
        for (int i = 0; i < p; i++) {
            if (i > 0) {
                countOur[i] = countOur[i - 1];
            }
            if (a[i] == h) {
                countOur[i]++;
            }
        }
        boolean[] can = new boolean[c];
        boolean[] anyExcept = new boolean[c];
        for (int i = 0; i < c; i++) {
            if (i == h) {
                continue;
            }
            for (int type = 0; type < 3; type++) {
                if (type == 0 && count[h] == 0) {
                    continue;
                }
                if (type == 1 && count[i] == 0) {
                    continue;
                }
                if (type == 2 && count[h] + count[i] == n) {
                    continue;
                }
                int our = type == 0 ? count[h] - 1 : count[h];
                int their = type == 1 ? count[i] - 1 : count[i];
                if (a[0] == h) {
                    our++;
                } else if (a[0] == i) {
                    their++;
                }
                // System.err.println(our + " " + their);
                int last = 0;
                for (int e = first[i];; e = next[e]) {
                    int all = e - last - 1;
                    int hereOur = getCount(countOur, last + 1, e);
                    int notOur = all - hereOur;
                    // System.err.println("all = " + all + " hereOur = " +
                    // hereOur
                    // + " " + " notOur = " + notOur);
                    if (all > 0 && a[e - 1] == h) {
                        our = Math.max(our - notOur, 1);
                    } else {
                        our = Math.max(our - notOur, 0);
                    }
                    if (their + our > n) {
                        their = n - our;
                    }
                    if (e < p) {
                        their = Math.min(their + 1, n);
                        our = Math.max(0, our - 1);
                    }
                    last = e;
                    // System.err.println(e + " " + our + " " + their);
                    if (e >= p)
                        break;
                }
                // System.err.println(i + " " + type + " " + their + " " + our);
                if (their >= our) {
                    if (type == 0) {
                        can[h] = true;
                    } else if (type == 1) {
                        can[i] = true;
                    } else {
                        anyExcept[i] = true;
                    }
                }
            }
        }
        int except = 0;
        for (boolean e : anyExcept) {
            except += e ? 1 : 0;
        }
        int[] ans = new int[n];
        int ac = 0;
        // System.err.println(Arrays.toString(can));
        // System.err.println(Arrays.toString(anyExcept));
        for (int i = 0; i < n; i++) {
            int x = b[i];
            if (x == h) {
                if (!can[h]) {
                    ans[ac++] = i;
                }
                continue;
            }
            int here = except - (anyExcept[x] ? 1 : 0);
            if (!can[x] && here == 0) {
                ans[ac++] = i;
            }
        }
        out.println(ac);
        for (int i = 0; i < ac; i++) {
            if (i > 0)
                out.print(' ');
            out.print(ans[i] + 1);
        }
        out.println();
    }

    static int getCount(int[] a, int l, int r) {
        if (l >= r)
            return 0;
        int ret = a[r - 1];
        if (l > 0) {
            ret -= a[l - 1];
        }
        return ret;
    }

    public static void main(String[] args) throws Exception {
        File file = new File("kabaleo.in");
        InputStream input = System.in;
        PrintStream output = System.out;
        if (file.exists() && file.canRead()) {
            input = new FileInputStream(file);
            output = new PrintStream("kabaleo.out");
        }
        br = new BufferedReader(new InputStreamReader(input));
        out = new PrintWriter(output);
        solve();
        out.close();
    }

    static BufferedReader br;
    static StringTokenizer st;
    static PrintWriter out;

    static String nextToken() throws IOException {
        while (st == null || !st.hasMoreTokens()) {
            String line = br.readLine();
            if (line == null) {
                return null;
            }
            st = new StringTokenizer(line);
        }
        return st.nextToken();
    }

    static int nextInt() throws IOException {
        return Integer.parseInt(nextToken());
    }

    static long nextLong() throws IOException {
        return Long.parseLong(nextToken());
    }

    static double nextDouble() throws IOException {
        return Double.parseDouble(nextToken());
    }
}
