import java.util.*; public class Main { public static void main(String[] args) throws Exception { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int m = sc.nextInt(); HashMap exists = new HashMap<>(); for (int i = 0; i < n; i++) { long x = sc.nextLong(); exists.put(x, exists.getOrDefault(x, 0) + 1); } StringBuilder sb = new StringBuilder(); for (int i = 0; i < m; i++) { if (i > 0) { sb.append(" "); } sb.append(exists.getOrDefault(sc.nextLong(), 0)); } System.out.println(sb); } }