Ivan is going to sleep now and wants to set his alarm clock. There will be many necessary events tomorrow, the $i$-th of them will start during the $x_i$-th minute. Ivan doesn't want to skip any of the events, so he has to set his alarm clock in such a way that it rings during minutes $x_1, x_2, \dots, x_n$, so he will be awake during each of these minutes (note that it does not matter if his alarm clock will ring during any other minute).

Ivan can choose two properties for the alarm clock — the first minute it will ring (let's denote it as $y$) and the interval between two consecutive signals (let's denote it by $p$). After the clock is set, it will ring during minutes $y, y + p, y + 2p, y + 3p$ and so on.

Ivan can choose any minute as the first one, but he cannot choose any arbitrary value of $p$. He has to pick it among the given values $p_1, p_2, \dots, p_m$ (his phone does not support any other options for this setting).

So Ivan has to choose the first minute $y$ when the alarm clock should start ringing and the interval between two consecutive signals $p_j$ in such a way that it will ring during all given minutes $x_1, x_2, \dots, x_n$ (and it does not matter if his alarm clock will ring in any other minutes).

Your task is to tell the first minute $y$ and the index $j$ such that if Ivan sets his alarm clock with properties $y$ and $p_j$ it will ring during all given minutes $x_1, x_2, \dots, x_n$ or say that it is impossible to choose such values of the given properties. If there are multiple answers, you can print any.


-----Input-----

The first line of the input contains two integers $n$ and $m$ ($2 \le n \le 3 \cdot 10^5, 1 \le m \le 3 \cdot 10^5$) — the number of events and the number of possible settings for the interval between signals.

The second line of the input contains $n$ integers $x_1, x_2, \dots, x_n$ ($1 \le x_i \le 10^{18}$), where $x_i$ is the minute when $i$-th event starts. It is guaranteed that all $x_i$ are given in increasing order (i. e. the condition $x_1 < x_2 < \dots < x_n$ holds).

The third line of the input contains $m$ integers $p_1, p_2, \dots, p_m$ ($1 \le p_j \le 10^{18}$), where $p_j$ is the $j$-th option for the interval between two consecutive signals.


-----Output-----

If it's impossible to choose such values $y$ and $j$ so all constraints are satisfied, print "NO" in the first line.

Otherwise print "YES" in the first line. Then print two integers $y$ ($1 \le y \le 10^{18}$) and $j$ ($1 \le j \le m$) in the second line, where $y$ is the first minute Ivan's alarm clock should start ringing and $j$ is the index of the option for the interval between two consecutive signals (options are numbered from $1$ to $m$ in the order they are given input). These values should be chosen in such a way that the alarm clock will ring during all given minutes $x_1, x_2, \dots, x_n$. If there are multiple answers, you can print any.


-----Examples-----
Input
3 5
3 12 18
2 6 5 3 3

Output
YES
3 4

Input
4 2
1 5 17 19
4 5

Output
NO

Input
4 2
1 5 17 19
2 1

Output
YES
1 1

Difficulty: interview

Starter code:

Solutions:
import sys
input=sys.stdin.readline

def gcd(x,y):
    if y==0:
        return x
    if x<y:
        x,y=y,x
    return gcd(y,x%y)

n,m=map(int,input().split())
X=list(map(int,input().split()))
P=list(map(int,input().split()))
d=X[1]-X[0]
for i in range(2,n):
    d=gcd(d,X[i]-X[i-1])
for i,p in enumerate(P):
    if d%p==0:
        print('YES')
        print(X[0],i+1)
        break
else:
    print('NO')

def gcd(a, b):
	while b != 0:
		a, b = b, a % b
	return a

[n, m] = [int(i) for i in input().split()]
x = [int(i) for i in input().split()]
g = 0
for i in range(n - 1):
	g = gcd(g, x[i + 1] - x[i])
cnt = 1
for i in input().split():
	j = int(i)
	if g % j == 0:
		print ("YES")
		print (x[0], cnt, sep = ' ')
		return
	cnt += 1
print ("NO")

from sys import *
from math import *
from collections import *

N, M = map(int, input().split())

events = list(map(int, input().split()))

p = list(map(int, input().split()))

g = events[1] - events[0]

for i in range(2, N):
    g = gcd(g, events[i] - events[i-1])
    
f = None

for i in range(M):
    if g % p[i] == 0:
        
        f =i + 1
        break

if f == None:
    print("NO")

else:
    print("YES")
    print(events[0],end=' ')
    print(f)    


def gcd(a, b):
    b = abs(b)
    while b != 0:
        r = a%b
        a,b = b,r
    return a

N, M = list(map(int, input().split()))
X = [int(a) for a in input().split()]
P = [int(a) for a in input().split()]
g = 0
for i in range(N-1):
    g = gcd(g, X[i]-X[i+1])
for i in range(M):
    if g % P[i] == 0:
        print("YES")
        print(X[0], i+1)
        break
else:
    print("NO")


n, m = map(int, input().split())
x = list(map(int, input().split()))
p = list(map(int, input().split()))
d = [x[i] - x[i - 1] for i in range(1, n)]
def gcd(a, b):
    if a == b:
        return a
    if a < b:
        return gcd(b, a)
    if b == 0:
        return a
    return gcd(a % b, b)
z = d[0]
for i in d:
    z = gcd(z, i)
a = []
f = False
for i in range(m):
    if z % p[i] == 0:
        print('YES')
        print(x[0], i + 1)
        f = True
        break
if not f:
    print('NO')

from math import gcd
n,m = list(map(int,input().split()))

X = list(map(int, input().split()))

P = list(map(int,input().split()))

g = X[1]-X[0]

for i in range(n-1):
    g = gcd(g, X[i+1] - X[i])


for i,j in enumerate(P):
    if g % j == 0:
        print("YES")
        print(X[0],i+1)
        return
print("NO")


n, m = list(map(int,input().split()))
x = list(map(int,input().split()))
p = list(map(int,input().split()))
def gcd(a, b):
	if a == 0:
		return b
	if b == 0:
		return a
	if a > b:
		a, b = b, a
	return gcd(a, b % a)
gie = x[1] - x[0]
for i in range(2,n):
	gie = gcd(gie, x[i]-x[i-1])
import sys
for i in range(m):
	if gie % p[i] == 0:
		print("YES")
		print(x[0], end =  " ")
		print(i + 1)
		return
print("NO")
#print(gcd(7,14))

from math import gcd

n,m = list(map(int,input().split()))
x = list(map(int,input().split()))
p = list(map(int,input().split()))
first = x[0]
x = [x[i+1]-x[i] for i in range(n-1)]
a = x[0]
for i in x[1:]:
    a = gcd(a,i)
for index, i in enumerate(p):
    if a % i == 0:
        print("YES")
        print(first, index+1)
        break
else:
    print("NO")


def pgcd(a,b):
    """pgcd(a,b): calcul du 'Plus Grand Commun Diviseur' entre les 2 nombres entiers a et b"""
    if b==0:
        return a
    else:
        r=a%b
        return pgcd(b,r)
n,e = map(int,input().split())
events = list(map(int,input().split()))
settings = list(map(int,input().split()))
r = -1
for k in range(0,len(events)-1):
	if(r==-1):
		r = events[k+1]-events[k]
	else:
		r = pgcd(r,events[k+1]-events[k])
ok = 0
for k in range(len(settings)):
	if(r%settings[k]==0):
		print("YES")
		print(events[0],k+1)
		ok = 1
		break
if(not ok):
	print("NO")

import math


n, m = list(map(int, input().split()))
x = input().split()
x = [int(xi) for xi in x]
p = input().split()
p = [int(pi) for pi in p]

gcds = x[1] - x[0]
for i in range(2, n):
    gcds = math.gcd(gcds, x[i] - x[i - 1])

for i in range(m):
    if gcds % p[i] == 0:
        print("YES")
        print(x[0], i + 1)
        return
print("NO")


n, m = list(map(int, input().split()))
u = list(map(int, input().split()))
p = list(map(int, input().split()))
for i in range(1, n):
    u[i] -= u[0]
h = u[0]
u[0] = 0
def gsd(a, b):
    a, b = max(a, b), min(a, b)
    if b == 0:
        return a
    return gsd(b, a % b)
for i in range(1, n):
    u[i] = gsd(u[i], u[i - 1])
for i in range(m):
    if u[-1] % p[i] == 0:
        print("YES")
        print(h, i + 1)
        return
print("NO")


n, m = list(map(int, input().split()))
x = tuple(map(int, input().split()))
y = min(x)
a = 0
for xi in x:
    b = xi - y
    while b:
        a, b = b, a % b
j = 1
for p in input().split():
    if a % int(p):
        j += 1
        continue
    print("YES")
    print(y, j)
    break
else:
    print("NO")


import sys
input = sys.stdin.readline

n,m=list(map(int,input().split()))
X=list(map(int,input().split()))
P=list(map(int,input().split()))

def gcd(a, b):
    while b:
        a, b = b, a % b
    return a

x=X[1]-X[0]

for i in range(1,n):
    x=gcd(x,X[i]-X[0])

for i in range(m):
    if x%P[i]==0:
        print("YES")
        print(X[0],i+1)
        return

print("NO")


import sys
def gcd(a, b):
    while a and b:
        if a >= b:
            a %= b
        else:
            b %= a
    return a | b

n, m = [int(s) for s in input().split()]
time = [int(s) for s in input().split()]
p = [int(s) for s in input().split()]
diffs = []
for i in range(len(time) - 1):
    diffs.append(time[i + 1] - time[i])
ans = max(diffs)
#print(diffs)
for i in range(len(diffs)):
    ans = gcd(ans, diffs[i])
for i in range(len(p)):
    if ans % p[i] == 0:
        print('YES')
        print(time[0], i + 1)
        return
print('NO')

import functools

n, m = list(map(int, input().strip().split()))
x = list(map(int, input().strip().split()))
p = list(map(int, input().strip().split()))

def gcd(a, b):
    while b:
        a, b = b, a % b
    return a

init = x[0]
for i in range(n):
    x[i] -= init

gcd_interval = functools.reduce(gcd, x)
for i in range(m):
    pi = p[i]
    if gcd_interval%pi == 0:
        print("YES")
        print(init, i+1)
        return
print("NO")

from math import gcd
from functools import reduce
n, m = [int(i) for i in input().split()]
x = [int(i) for i in input().split()]
p = [int(i) for i in input().split()]
s = [x[i+1] - x[i] for i in range(n-1)]
g = reduce(gcd, s)
for i in range(m):
    if g%p[i] == 0:
        print('YES')
        print(x[0], i+1)
        break
else:
    print('NO')


n,m=list(map(int,input().split()))
a = list(map(int,input().split()))
t = list(map(int,input().split()))
def gcd(a,b):
    if b==0:
        return a
    else:
        return gcd(b,a%b)
g = a[1]-a[0]
for i in range(n-1):
    g = gcd(g,a[i+1]-a[i])
    if g==1:
        break
idx=-1
for i in range(m):
    if g%t[i]==0:
        idx=i
        break
    
if idx==-1:
    print("NO")
else:
    print("YES")
    print(a[0],idx+1)


import math
from functools import reduce

n, m = map(int, input().split())


t = [int(x) for x in input().split()]

p = [int(x) for x in input().split()]

tt = reduce(math.gcd, [x - t[0] for x in t])

for i, pp in enumerate(p, start=1):
    if tt % pp == 0:
        print("YES")
        print(t[0], i)
        break

else:
    print("NO")

n, m = list(map(int, input().split()))
xrr = [int(x) for x in input().split()]
prr = [int(x) for x in input().split()]
xrr.sort()
gcd = xrr[1] - xrr[0]
for i in range(1, n - 1):
    u = gcd
    v = xrr[i + 1] - xrr[i]
    temp = 0
    while v:
        temp = u % v
        u = v
        v = temp
    gcd = u
for i in range(m):
    if gcd % prr[i] == 0:
        print('YES')
        print(xrr[0], i + 1)
        break
else:
    print('NO')


import math
n, m = map(int, input().split())

xEvents = list(map(int, input().split()))

pInterval = list(map(int, input().split()))

Interval = [xEvents[i] - xEvents[i - 1] for i in range(1, n)]

pList = [Interval[0]]

for i in range(1, n - 1):
    pList.append(math.gcd(pList[-1], Interval[i]))

able = 0
for i in range(len(pInterval)):
    if pList[-1]%pInterval[i] == 0:
        print("YES")
        print(xEvents[0], end = " ")
        print(i + 1)
        able = 1 
        break

if able == 0:
    print("NO")



from bisect import bisect_right as br
from bisect import bisect_left as bl
from collections import *
from itertools import *
import functools
import sys
from math import *
import random
import re
MAX = sys.maxsize
MAXN = 10**5+10
MOD = 10**9+7
def isprime(n):
    n = abs(int(n))
    if n < 2:
        return False
    if n == 2: 
        return True    
    if not n & 1: 
        return False
    for x in range(3, int(n**0.5) + 1, 2):
        if n % x == 0:
            return False
    return True

def mhd(a,b,x,y):
    return abs(a-x)+abs(b-y)

def numIN(x = " "):
    return(list(map(int,sys.stdin.readline().strip().split(x))))

def charIN(x= ' '):
    return(sys.stdin.readline().strip().split(x))

def arrIN():
    return list(numIN())

def dis(x,y):
    a = y[0]-x[0]
    b = x[1]-y[1]
    return (a*a+b*b)**0.5

def lgcd(a):
    g = a[0]
    for i in range(1,len(a)):
        g = math.gcd(g,a[i])
    return g

def ms(a):
    msf = -MAX
    meh = 0

    for i in range(len(a)):
        meh+=a[i]
        if msf<meh:
            msf = meh
        if meh<0:
            meh = 0
    return msf


def res(ans,t):
    print('Case #{}: {}'.format(t,ans))

n,m = numIN()
x = arrIN()
p = arrIN()

g = 0
for i in range(1,n):
    g = gcd(g,x[i]-x[i-1])

for i in range(m):
    if p[i]==g or g%p[i]==0:
        print('YES')
        print(x[0],i+1)
        return
print('NO')