#K51547. Maximum Request Fulfillment
Maximum Request Fulfillment
Maximum Request Fulfillment
You are given (n) coins and (m) requests. Each coin has an integer value and each request requires a coin with an exact matching value. Each coin can be used at most once. Your task is to determine the maximum number of requests that can be fulfilled by matching coins to requests exactly.
For example, suppose you have 5 coins with values [1, 2, 3, 4, 5] and 3 requests [2, 4, 6]. You can fulfill the requests for values 2 and 4, so the answer is 2.
inputFormat
The input is given from standard input (stdin) in the following format:
The first line contains two space-separated integers (n) and (m), representing the number of coins and the number of requests respectively. The second line contains (n) space-separated integers, the values of the coins. The third line contains (m) space-separated integers, the values required by each request.
outputFormat
Output a single integer to standard output (stdout), which is the maximum number of requests that can be fulfilled.## sample
5 3
1 2 3 4 5
2 4 6
2
</p>