A Set Problem

View as PDF

Submit solution

Points: 5
Time limit: 2.0s
Memory limit: 64M

Author:
Problem type

Given a set of N distinct positive integers, find the number of different repeating positive integers from a new set of M distinct positive integers compared to the set N.

Input Specification

The first line will contain two space-separated integers N and M (1 \le N, M \le 10^4).

The second line will contain N space-separated integers a_1,a_2,...,a_n (1 \le a_i \le 10^5).

The third line will contain M space-separated integers a_1,a_2,...,a_m (1 \le a_i \le 10^5).

Output Specification

Print out one integer representing the number of repeating positive integers.

Sample Input

5 4
1 2 3 4 5
3 6 5 7

Sample Output

2

Explanation

The array M has two repeating numbers (3 and 5).


Comments

There are no comments at the moment.