아름다운 수열
import java.util.*;
import java.io.*;
public class Main {
static List<Integer> A;
static List<Integer> B;
public static void main(String[] args) throws IOException{
A = new ArrayList<>();
B = new ArrayList<>();
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int N = Integer.parseInt(br.readLine());
StringTokenizer st;
for(int i = 0; i < N; i++){
st = new StringTokenizer(br.readLine());
int num = Integer.parseInt(st.nextToken());
A.add(num);
}
int M = Integer.parseInt(br.readLine());
for(int i = 0; i < M; i++){
st = new StringTokenizer(br.readLine());
int num = Integer.parseInt(st.nextToken());
B.add(num);
}
Collections.sort(B);
int cnt = 0;
StringBuilder sb = new StringBuilder();
for(int i = 0; i + M <= N && i < N; i++){
List<Integer> part = new ArrayList<>();
for(int j = 0; j < M; j++){
part.add(A.get(i + j));
}
Collections.sort(part);
if(isBeautiful(part)){
cnt++;
sb.append(i + 1).append("\n");
}
}
System.out.println(cnt);
System.out.println(sb);
}
public static boolean isBeautiful(List<Integer> part){
int diff = part.get(0) - B.get(0);
for(int i = 1; i < part.size(); i++){
if(part.get(i) - B.get(i) != diff){
return false;
}
}
return true;
}
}