Problem2116--ABC185E Sequence Matching

2116: ABC185E Sequence Matching

[Creator : ]
Time Limit : 1.000 sec  Memory Limit : 128 MB

Description

Problem Statement

We have an integer sequence A of length N and an integer sequence B of length M.
Takahashi will make a new sequence A by removing some elements (possibly zero or all) from A and concatenating the remaining elements.
Similarly, he will make another new sequence B by removing some elements (possibly zero or all) from B and concatenating the remaining elements.
Here, he will remove elements so that |A|=|B|. (|s| denotes the length of s for a sequence s.)
Let x be the total number of elements removed from A and B, and y be the number of integers ii such that 1i|A| and AiBi. Print the minimum possible value of x+y.

Constraints

  • 1N,M1000
  • 1Ai,Bi109
  • All values in input are integers.

Input

Input

Input is given from Standard Input in the following format:
N M 
A1 A2 A3 AN
B1 B2 B3 BM


Output

Output

Print the minimum possible value of x+y.

Sample Input Copy

4 3
1 2 1 3
1 3 1

Sample Output Copy

2

HINT

If we make A by removing A4 from A, and B by removing nothing from Bx will be 1.
Here, there is just one integer i such that 1i|A| and AiBii=2 so y will be 1, and x+y will be 2, which is the minimum possible value.