{"raw_statement":[{"iden":"problem statement","content":"We have an integer sequence $A$ of length $N$ and an integer sequence $B$ of length $M$.  \nTakahashi will make a new sequence $A'$ by removing some elements (possibly zero or all) from $A$ and concatenating the remaining elements.  \nSimilarly, he will make another new sequence $B'$ by removing some elements (possibly zero or all) from $B$ and concatenating the remaining elements.  \nHere, he will remove elements so that $|A'| = |B'|$. ($|s|$ denotes the length of $s$ for a sequence $s$.)  \nLet $x$ be the total number of elements removed from $A$ and $B$, and $y$ be the number of integers $i$ such that $1 \\le i \\le |A'|$ and ${A'}_i \\neq {B'}_i$. Print the minimium possible value of $x + y$."},{"iden":"constraints","content":"*   $1 \\le N, M \\le 1000$\n*   $1 \\le A_i, B_i \\le 10^9$\n*   All values in input are integers."},{"iden":"input","content":"Input is given from Standard Input in the following format:\n\n$N$ $M$\n$A_1 \\hspace{7pt} A_2 \\hspace{7pt} A_3 \\hspace{5pt} \\dots \\hspace{5pt} A_N$\n$B_1 \\hspace{7pt} B_2 \\hspace{7pt} B_3 \\hspace{5pt} \\dots \\hspace{5pt} B_M$"},{"iden":"sample input 1","content":"4 3\n1 2 1 3\n1 3 1"},{"iden":"sample output 1","content":"2\n\nIf we make $A'$ by removing $A_4$ from $A$, and $B'$ by removing nothing from $B$, $x$ will be $1$.  \nHere, there is just one integer $i$ such that $1 \\le i \\le |A'|$ and ${A'}_i \\neq {B'}_i$: $i = 2$, so $y$ will be $1$, and $x + y$ will be $2$, which is the minimum possible value."},{"iden":"sample input 2","content":"4 6\n1 3 2 4\n1 5 2 6 4 3"},{"iden":"sample output 2","content":"3\n\nIf we remove nothing from $A$ and remove $B_4, B_6$ from $B$, we have $x = 2, y = 1$, and $x + y = 3$, which is the minimum possible value."},{"iden":"sample input 3","content":"5 5\n1 1 1 1 1\n2 2 2 2 2"},{"iden":"sample output 3","content":"5\n\nIt is allowed to remove nothing from both $A$ and $B$."}],"translated_statement":null,"sample_group":[],"show_order":["default"],"formal_statement":null,"simple_statement":null,"has_page_source":true}