The following languages are only available languages for the problems from the contest

Kotlin Heroes: Episode 4:

- Kotlin 1.4.0

Virtual contest is a way to take part in past contest, as close as possible to participation on time. It is supported only ICPC mode for virtual contests.
If you've seen these problems, a virtual contest is not for you - solve these problems in the archive.
If you just want to solve some problem from a contest, a virtual contest is not for you - solve this problem in the archive.
Never use someone else's code, read the tutorials or communicate with other person during a virtual contest.

No tag edit access

The problem statement has recently been changed. View the changes.

×
G. Two IP Cameras

time limit per test

3 secondsmemory limit per test

256 megabytesinput

standard inputoutput

standard outputYou have two IP cameras of the same model. Each camera can take photos starting from some moment of time with a fixed period. You can freely choose the starting moment but you can choose the period only as one of $$$k$$$ values $$$p_1, p_2, \dots, p_k$$$ which are chosen by the camera's manufacturer.

You have $$$n$$$ moments of interest $$$x_1, x_2, \dots, x_n$$$. You'd like to configure both cameras in such a way that at least one camera will take a photo in each of these moments. Configuring the camera means setting the moment when it takes the first photo and the gap between two consecutive photos (which should be one of the values $$$p_1, p_2, \dots, p_k$$$). It's not a problem for you that cameras can take photos at other moments of time — you only care about moments of interest.

Input

The first line contains two integers $$$k$$$ and $$$n$$$ ($$$1 \le k \le 10^5$$$; $$$2 \le n \le 10^5$$$) — the number of periods to choose and the number of moments of interest.

The second line contains $$$k$$$ integers $$$p_1, p_2, \dots, p_k$$$ ($$$1 \le p_1 < p_2 < \dots < p_k \le 10^6$$$) — the periods to choose in the ascending order.

The third line contains $$$n$$$ integers $$$x_1, x_2, \dots, x_n$$$ ($$$1 \le x_1 < x_2 < \dots < x_n \le 10^6$$$) — the moments of interest in the ascending order.

Output

Print YES (case insensitive) in the first line if there is a way to configure cameras.

In the second line, print two integers $$$s_1$$$ and $$$cp_1$$$ ($$$1 \le s_1 \le 10^6$$$; $$$1 \le cp_1 \le 10^6$$$; $$$cp_1 \in \{p_1, \dots, p_k\}$$$) — the starting moment and the period for the first camera. The period should be one of the given periods.

In the third line, print two integers $$$s_2$$$ and $$$cp_2$$$ ($$$1 \le s_2 \le 10^6$$$; $$$1 \le cp_2 \le 10^6$$$; $$$cp_2 \in \{p_1, \dots, p_k\}$$$) — the starting moment and the period for the second camera. The period should be one of the given periods.

If there is no way to configure cameras, print NO (case insensitive). If there are multiple ways, you may print any of them.

Examples

Input

3 5 3 5 7 1 4 5 7 12

Output

YES 1 3 5 7

Input

3 2 1 2 3 1 10

Output

YES 1 1 10 1

Input

3 4 1 2 3 5 7 9 11

Output

YES 5 1 5 1

Input

3 4 10 20 100 2 3 4 7

Output

NO

Codeforces (c) Copyright 2010-2021 Mike Mirzayanov

The only programming contests Web 2.0 platform

Server time: Apr/13/2021 23:00:49 (j3).

Desktop version, switch to mobile version.

Supported by

User lists

Name |
---|