Count how many distinct item values are allowed to appear in the collection after excluding the forbidden ones.
Problem
Valera has a collection of antique items, each item described by an integer value. Some values are considered forbidden. Your task is to determine how many items in the collection are not forbidden.
More precisely, you are given a list of item values and a list of forbidden values. Count how many item occurrences have values that do not appear in the forbidden list.
Goal
Return the number of collectible items that remain after removing all items whose value is forbidden.
Input Format
- The first line contains two integers and .
- The second line contains integers describing the item values.
- The third line contains integers describing the forbidden values.
Output Format
- Print a single integer: the number of item occurrences whose value is not forbidden.
Constraints
- if using the standard Codeforces formulation.
- Item values and forbidden values fit in 32-bit signed integers.
- Time-efficient membership checking is expected.
Example 1
Input
5 3 1 2 3 4 5 2 4 6
Output
3
Explanation
The forbidden values are 2, 4, and 6. Among the five items, values 1, 3, and 5 are allowed, so the answer is 3.
Premium problem context
Unlock deeper context for this problem
Premium adds guided hints, editorial links, similar variants, discussion resources, and concept maps so you can understand why a problem matters, not just solve it once.