import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.StringTokenizer;

public class kabaleo_keka_stress {
    private static void solve() throws IOException {
        int stacks = nextInt();
        int players = nextInt();
        int colors = nextInt();
        int ourColor = nextInt() - 1;

        int[] stackInitialColor = new int[stacks];
        for (int i = 0; i < stacks; i++) {
            stackInitialColor[i] = nextInt() - 1;
        }

        int[] hands = new int[players];
        for (int i = 0; i < players; i++) {
            hands[i] = nextInt() - 1;
        }

        List<Integer> moves = solve(stacks, players, colors, ourColor, stackInitialColor, hands);
        out.println(moves.size());
        for (int i = 0; i < moves.size(); i++) {
            if (i > 0) {
                out.print(' ');
            }
            out.print(moves.get(i) + 1);
        }
        out.println();
    }

    static List<Integer> solve(int stacks, int players, int colors, int ourColor, int[] stackInitialColor, int[] hands) {
        int[] count = new int[colors];
        for (int i = 0; i < stacks; i++) {
            ++count[stackInitialColor[i]];
        }

        int ourHand = hands[0];
        int[] playersHold = new int[colors];
        int lastPlayerPuts = ourHand;
        for (int i = 0; i < players - 1; i++) {
            int cur = hands[i + 1];
            ++playersHold[cur];
            lastPlayerPuts = cur;
        }

        if (stacks == 1) {
            if (lastPlayerPuts == ourColor) {
                return Collections.singletonList(0);
            } else {
                return Collections.emptyList();
            }
        }

        int countEnemies = players - 1 - playersHold[ourColor];

        if (count[ourColor] == stacks && ourHand != ourColor) {
            --count[ourColor];
            ++count[ourHand];
            ourHand = -1;
        }

        if (countEnemies >= count[ourColor]) {
            return Collections.emptyList();
        }

        for (int i = 0; i < colors; i++) {
            if (i == ourColor) {
                continue;
            }
            count[ourColor] -= playersHold[i];
            count[i] += playersHold[i];
        }

        int max1 = -1, max2 = -1;

        for (int i = 0; i < colors; i++) {
            if (i == ourColor) {
                continue;
            }
            if (max1 < 0 || count[i] > count[max1]) {
                max2 = max1;
                max1 = i;
            } else {
                if (max2 < 0 || count[i] > count[max2]) {
                    max2 = i;
                }
            }
        }

        if (ourHand < 0) {
            if (count[ourColor] > count[max1]) {
                List<Integer> answer = new ArrayList<>();
                for (int i = 0; i < stacks; i++) {
                    answer.add(i);
                }
                return answer;
            } else {
                return Collections.emptyList();
            }
        }

        List<Integer> moves = new ArrayList<>();

        for (int ourMove = 0; ourMove < stacks; ourMove++) {
            int was = stackInitialColor[ourMove];
            --count[was];
            ++count[ourHand];

            if (count[ourColor] > count[max1]
                    && (max2 < 0 || count[ourColor] > count[max2])
                    && (ourHand == ourColor || count[ourColor] > count[ourHand])) {

                moves.add(ourMove);
            }

            ++count[was];
            --count[ourHand];
        }
        return moves;
    }

    public static void main(String[] args) throws IOException {
        br = new BufferedReader(new FileReader("kabaleo.in"));
        out = new PrintWriter("kabaleo.out");
        solve();
        out.close();
    }

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

    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());
    }

}