Distinct Sums#5903

Distinct Sums

2 seconds
64 megabytes
Easy

You are given two arrays of positive integers: the first array contains elements a_1, a_2, \dots, a_n, and the second array contains elements b_1, b_2, \dots, b_m.

Determine the number of distinct elements in the set

S = \{a_i + b_j \mid 1 \leq i \leq n,\ 1 \leq j \leq m\}.

Input

The first line contains two integers and (1 \leq n, m \leq 10^5).

The second line contains positive integers a_1, a_2, \dots, a_n (1 \leq a_i \leq 10^5).

The third line contains positive integers b_1, b_2, \dots, b_m (1 \leq b_j \leq 10^5).

Output

Print a single integer: the number of distinct elements in the set .

Examples

Example 1

Loading
Loading