CF1120A Diana and Liana

题目描述

Shortriver 镇举办了传统的花卉节。小镇上的居民们在节日期间都会佩戴有 $k$ 朵花的花环。共 $n$ 位居民每人都会得到一个花环。 有一条藤蔓,上面有 $m$ 朵花,这条藤蔓是一个序列 $a$,$a_i$ 表示第 $i$ 朵花的类型。有一台机器来切割这条藤蔓,它会一直切下藤蔓前端的 $k$ 朵花,直到剩下的花数量不足 $k$。 Diana 制作了一个花环示意图,是一个长度为 $s$ 的序列 $b$。Diana 要按照这个示意图制作一个花环,要求机器切割下来的花环至少有一个包含序列 $b$ 里所有类型的花。**如果一种类型的花在此序列中出现多次,则该类型的花朵数量至少应为该序列中该花的出现次数。花朵的顺序无关紧要。** 为了制作这个花环,Diana 可以取下藤蔓上的一些花朵,但又要保证每个居民都能得到一个花环(**Diana 自己也算一位居民**)。请给出一种取下花朵的方案。

输入格式

第一行包含四个整数 $m$,$k$,$n$ 和 $s$($1\leq n,k,m\leq 5\times 10^5$,$k\times n\leq m$,$1\leq s \leq k$),分别表示藤蔓上的花数,一个花环中的花数,居民的数量和戴安娜的示意图序列长度。 第二行包含 $m$ 个整数 $a_1,a_2,a_3,\cdots ,a_m$($1\leq a_i\leq 5\times 10^5$),表示藤蔓上的花朵类型。 第三行包含 $s$ 个整数 $b_1,b_2,b_3,\cdots ,b_s$($1\leq b_i\leq 5\times 10^5$),表示示意图上的花朵类型。

输出格式

如果无法达成 Diana 的要求,输出 $-1$。 否则在第一行输出一个整数 $d$,表示 Diana 要取下的花朵数量。在下一行输出 $d$ 个整数,表示要取下的花朵的位置。

说明/提示

In the first example, if you don't remove any flowers, the machine would put out two workpieces with flower types $ [1, 2, 3] $ and $ [3, 2, 1] $ . Those workpieces don't fit Diana's schematic. But if you remove flower on $ 4 $ -th place, the machine would output workpieces $ [1, 2, 3] $ and $ [2, 1, 2] $ . The second workpiece fits Diana's schematic. In the second example there is no way to remove flowers so that every citizen gets a wreath and Diana gets a workpiece that fits here schematic. In the third example Diana is the only citizen of the town and that means she can, for example, just remove all flowers except the ones she needs.