Peter the gangster is the new mob boss in the city and wants to grow his affairs as fast as possible. The best way to do that is by collection some _pizzo_ (protection taxes) from influential people that are already _protected_ by other mob bosses. Peter can establish _friendship_ relations with any mob for some amount of money. One person may have multiple mobsters _protecting_ him. To be able to get money from a person, Peter needs first to be _friend_ with the mobsters _protecting_ him.
Given for each person the amount of money he is able to pay and for each mobster the amount of money requested for his _friendship_, find the maximum amount of money Peter can collect.
The first line of the input contains 2 numbers, $1 <= N <= 100$ (the number of mob bosses) and $1 <= M <= 100$ (the number of influential people).
The next line contains $N$ numbers representing the amount of money each mob requests for his _friendship_.
The next line contains $M$ numbers representing the amount of money each person is able to pay.
The next $M$ lines will contain, for each person $i$, the number $k_i$, the number of mobsters protecting person $i$, followed by $k_i$ numbers representing the mobsters protecting person $i$.
Any amount of money in the input is a positive integer $<= 5000$.
The output should contain a number containing the maximum amount of money Peter can collect.
## Input
The first line of the input contains 2 numbers, $1 <= N <= 100$ (the number of mob bosses) and $1 <= M <= 100$ (the number of influential people). The next line contains $N$ numbers representing the amount of money each mob requests for his _friendship_.The next line contains $M$ numbers representing the amount of money each person is able to pay. The next $M$ lines will contain, for each person $i$, the number $k_i$, the number of mobsters protecting person $i$, followed by $k_i$ numbers representing the mobsters protecting person $i$. Any amount of money in the input is a positive integer $<= 5000$.
## Output
The output should contain a number containing the maximum amount of money Peter can collect.
[samples]
**Definitions**
Let $ n \in \mathbb{Z}^+ $ be the size of the array.
Let $ A = ((a_1, c_1), (a_2, c_2), \dots, (a_n, c_n)) $ be the sequence of pairs, where $ a_i \in \mathbb{Z} $ is the value and $ c_i \in \mathbb{Z}^+ $ is the color of the $ i $-th element.
**Constraints**
1. $ 1 \leq n \leq 200000 $
2. $ -10^9 \leq a_i \leq 10^9 $
3. $ 1 \leq c_i \leq 200000 $
**Objective**
Determine whether it is possible to sort $ A $ by value (i.e., obtain a sequence $ A' = ((a'_1, c'_1), \dots, (a'_n, c'_n)) $ such that $ a'_1 \leq a'_2 \leq \dots \leq a'_n $) using only adjacent swaps between elements of **different colors**.
**Key Insight**
Two elements can be swapped if and only if they have different colors. Therefore, elements with the **same color** cannot pass through each other. Thus, the **relative order of elements with the same color must already be non-decreasing in the target sorted sequence**.
Let $ S $ be the sequence $ A $ sorted by value (breaking ties arbitrarily).
For each color $ c $, let $ L_c $ be the subsequence of $ S $ consisting of all elements with color $ c $, in the order they appear in $ S $.
Let $ T_c $ be the subsequence of the original array $ A $ consisting of all elements with color $ c $, in their original order.
Then, the answer is **YES** if and only if for every color $ c $, the sequence $ T_c $ is equal to $ L_c $ (i.e., the relative order of elements of each color is preserved in the sorted array).
$$
\boxed{\text{YES}} \quad \text{if and only if} \quad \forall c, \; \text{the subsequence of elements with color } c \text{ in } A \text{ is in non-decreasing order of } a_i \text{ in the globally sorted array.}
$$