Олимпиадный тренинг

Задача 28345. Two identical arrays


Задача

Темы:
The input is two arrays A and B, sorted in non-descending order. You need to find out if there exists a number that is contained in both arrays. If such a number exists, print 1, otherwise print 0.

Input
The first line contains the natural numbers N and M– the number of elements of the first and second array respectively,  (1 <= N, M <= 1e8). The next two lines contain the elements of the array A and B. The second line contains the elements of the array A, the third contains the elements of the array B. All elements of the array are non-negative numbers not exceeding 1018.

Imprint
Print the answer to the problem.
 
Examples
# Input Output
1 4 4
1 2 3 4
2 4 7 8
1