#P7280. Pizza Order Problem

    ID: 20479 Type: Default 1000ms 256MiB

Pizza Order Problem

Pizza Order Problem

A pizza shop offers \( m \) different pizzas. Each pizza comes with a set of toppings. For the \( i \)-th pizza, it has \( k_i \) toppings with identifiers \( b_{i,1}, b_{i,2}, \dots, b_{i,k_i} \). Mirko is very picky when it comes to food; he dislikes \( n \) toppings, given by \( a_1, a_2, \dots, a_n \). He wants to order a pizza that does not contain any of these disliked toppings. Your task is to determine the number of pizzas that Mirko can order.

inputFormat

The input begins with two integers \( m \) and \( n \) separated by a space.

The second line contains \( n \) integers \( a_1, a_2, \dots, a_n \) representing the toppings Mirko dislikes.

The next \( m \) lines describe each pizza. The \( i \)-th of these lines starts with an integer \( k_i \) followed by \( k_i \) positive integers \( b_{i,1}, b_{i,2}, \dots, b_{i,k_i} \) representing the toppings present on that pizza.

outputFormat

Output a single integer representing the number of pizzas that do not contain any of the toppings that Mirko dislikes.

sample

3 1
1
3 1 2 3
2 2 4
1 3
2

</p>