There are $N$ decks of cards, each card in which has an integer between $1$ and $M$, inclusive, written on it. The $i$\-th deck $(1\leq i \leq N)$ contains $K_i$ cards, and the number written on the $j$\-th card from the top is $A_{i,j}\ (1\leq j \leq K_i)$.
Initially, the integers written on the cards satisfy the following conditions:
* For each integer $x\ (1\leq x \leq M)$, there are exactly two cards with $x$ written on them, each in a different deck.
* The integers written on the top cards of all the decks are pairwise different.
We can perform the following operation on the $N$ decks:
* Choose a deck that still has cards and discard the top card. After discarding, the integers written on the top cards of the decks that still have cards must remain pairwise different.
Determine the maximum number of times this operation can be performed.
## Constraints
* $2 \leq N \leq M$
* $2 \leq M \leq 2 \times 10^5$
* $1 \leq K_i \leq M$
* $1 \leq A_{i,j} \leq M$
* For each integer $x\ (1\leq x \leq M)$, there are exactly two pairs $(i,j)$ such that $x=A_{i,j}$, and the two values of $i$ are different.
* $A_{i,1}\ (1\leq i \leq N)$ are pairwise different.
* All input values are integers.
## Input
The input is given from Standard Input in the following format:
$N$ $M$
$K_1$ $A_{1,1}$ $A_{1,2}$ $\dots$ $A_{1,K_1}$
$K_2$ $A_{2,1}$ $A_{2,2}$ $\dots$ $A_{2,K_2}$
$\vdots$
$K_N$ $A_{N,1}$ $A_{N,2}$ $\dots$ $A_{N,K_N}$
[samples]