Farmer John is still investigating the problem of cows crossing the road through his farm, introduced in the previous two problems. He now realizes that the threshold for friendliness is more subtle than before: breeds and are considered friendly if |a - b| \le k, and unfriendly otherwise.
Given the ordering of the fields on each side of the road through FJ's farm, determine the number of unfriendly crossing pairs of breeds, where a crossing pair is defined as in the previous problems.
The first line contains two integers n~(1 \le n \le 10^5) and k~(0 \le k < n).
The next lines describe the order of the fields on one side of the road by breed ID. Each breed ID is an integer from to .
The following lines describe the order of the fields on the other side of the road, again by breed ID. Each breed ID appears exactly once in each ordering.
Print the number of unfriendly crossing pairs of breeds.
In this example, breeds and form an unfriendly crossing pair, as do breeds and .
Example 1