#include<bits/stdc++.h>
#define ll long long
using namespace std;
ll gcd(ll a, ll b) {
	return a == 0 ? b : gcd(b%a, a);
}
int main() {
	int n, m; cin >> n >> m;
	ll ori, lat; scanf("%I64d %I64d", &ori, &lat);
	ll res = lat - ori;
	ll sto = ori;
	if (res != 1) {
		for (int i = 3; i <= n; i++) {
			ori = lat;
			scanf("%I64d", &lat);
			if (lat - ori == 1) {
				res = 1;
				break;
			}
			res = gcd(res, lat - ori);
			//if (res == 1) { // gcd����û��1���������1������������  !!����ҲҪ��
			//	break; //��仰����
			//}
		}
	}
	ll inp;
	for (int i = 1; i <= m; i++) {
		scanf("%I64d", &inp);
		if (res%inp == 0) {
			cout << "YES" << endl;
			printf("%I64d %d", sto, i);
			return 0;
		}
	}
	cout << "NO" << endl;
	return 0;

}


#include<bits/stdc++.h>
#define ll long long
using namespace std;
inline ll gcd(ll a, ll b) {
	return a == 0 ? b : gcd(b%a, a);
}
int main() {
	int n, m; cin >> n >> m;
	ll ori, lat; scanf("%I64d %I64d", &ori, &lat);
	ll res = lat - ori;
	ll sto = ori;
//	if (res != 1) {
//		for (int i = 3; i <= n; i++) {
//			ori = lat;
//			scanf("%I64d", &lat);
//			if (lat - ori == 1) {
//				res = 1;
//				break;
//			}
//			res = gcd(res, lat - ori);
//			if (res == 1) { // gcd����û��1���������1������������  !!����ҲҪ��
//				break;
//			}
//		}
//	}
	for (int i = 3; i <= n; i++) {
			ori = lat;
			scanf("%I64d", &lat);
			if (lat - ori == 1) {
				res = 1;
				break;
			}
			res = gcd(res, lat - ori);
//			if (res == 1) { // gcd����û��1���������1������������  !!����ҲҪ��
//				break;
//			}
		}
	ll inp;
	for (int i = 1; i <= m; i++) {
		scanf("%I64d", &inp);
		if (res%inp == 0) {
			cout << "YES" << endl;
			printf("%I64d %d", sto, i);
			return 0;
		}
	}
	cout << "NO";
	return 0;

}


#include<bits/stdc++.h>
#define ll long long
using namespace std;
inline ll gcd(ll a, ll b) {
	return a == 0 ? b : gcd(b%a, a);
}
int main() {
	int n, m; cin >> n >> m;
	ll ori, lat; scanf("%I64d %I64d", &ori, &lat);
	ll res = lat - ori;
	ll sto = ori;
	if (res != 1) {
		for (int i = 3; i <= n; i++) {
			ori = lat;
			scanf("%I64d", &lat);
			if (lat - ori == 1) {
				res = 1;
				break;
			}
			res = gcd(res, lat - ori);
//			if (res == 1) { // gcd����û��1���������1������������  !!����ҲҪ��
//				break;
//			}
		}
	}
//	for (int i = 3; i <= n; i++) {
//			ori = lat;
//			scanf("%I64d", &lat);
//			if (lat - ori == 1) {
//				res = 1;
//				break;
//			}
//			res = gcd(res, lat - ori);
////			if (res == 1) { // gcd����û��1���������1������������  !!����ҲҪ��
////				break;
////			}  ��һ�����
//		}
	ll inp;
	for (int i = 1; i <= m; i++) {
		scanf("%I64d", &inp);
		if (res%inp == 0) {
			cout << "YES" << endl;
			printf("%I64d %d", sto, i);
			return 0;
		}
	}
	cout << "NO";
	return 0;

}


#include<bits/stdc++.h>
#define ll long long
using namespace std;
inline ll gcd(ll a, ll b) {
	return a == 0 ? b : gcd(b%a, a);
}
int main() {
	int n, m; cin >> n >> m;
	ll ori, lat; scanf("%I64d %I64d", &ori, &lat);
	ll res = lat - ori;
	ll sto = ori;
	if (res != 1) {
		for (int i = 3; i <= n; i++) {
			ori = lat;
			scanf("%I64d", &lat);
			if (lat - ori == 1) {
				res = 1;
				break;
			}
			res = gcd(res, lat - ori);
			if (res == 1) { // gcd����û��1���������1������������  !!����ҲҪ��
				break;
			}
		}
	}
	int inp;
	for (int i = 1; i <= m; i++) {
		scanf("%I64d", &inp);
		if (res%inp == 0) {
			cout << "YES" << endl;
			printf("%I64d %d", sto, i);
			return 0;
		}
	}
	cout << "NO" << endl;
	return 0;

}


#include<bits/stdc++.h>
#define ll long long
using namespace std;
//inline ll gcd(ll a, ll b) {
//	return a == 0 ? b : gcd(b%a, a);
//}
inline ll gcd(ll a,ll b){
	return b?gcd(b,a%b):a;
}
int main() {
	int n, m; cin >> n >> m;
	ll ori, lat; scanf("%I64d %I64d", &ori, &lat);
	ll res = lat - ori;
	ll sto = ori;
	if (res != 1) {
		for (int i = 3; i <= n; i++) {
			ori = lat;
			scanf("%I64d", &lat);
			if (lat - ori == 1) {
				res = 1;
				break;
			}
			res = gcd(res, lat - ori);
			if (res == 1) { // gcd����û��1���������1������������  !!����ҲҪ��
				break; //��仰����
			}
		}
	}
	ll inp;
	for (int i = 1; i <= m; i++) {
		scanf("%I64d", &inp);
		if (res%inp == 0) {
			cout << "YES" << endl;
			printf("%I64d %d", sto, i);
			return 0;
		}
	}
	cout << "NO" << endl;
	return 0;
}


#include<bits/stdc++.h>
#define ll long long
using namespace std;
//inline ll gcd(ll a, ll b) {
//	return a == 0 ? b : gcd(b%a, a);
//}
inline ll gcd(ll a,ll b){
	return b?gcd(b,a%b):a;
}
int main() {
	int n, m; cin >> n >> m;
	ll ori, lat; scanf("%I64d %I64d", &ori, &lat);
	ll res = lat - ori;
	ll sto = ori;
	if (res != 1) {
		for (int i = 3; i <= n; i++) {
			ori = lat;
			scanf("%I64d", &lat);
			if (lat - ori == 1) {
				res = 1;
				break;
			}
			res = gcd(res, lat - ori);
//			if (res == 1) { // gcd����û��1���������1������������  !!����ҲҪ��
//				break; //��仰����
//			}
		}
	}
	ll inp;
	for (int i = 1; i <= m; i++) {
		scanf("%I64d", &inp);
		if (res%inp == 0) {
			cout << "YES" << endl;
			printf("%I64d %d", sto, i);
			return 0;
		}
	}
	cout << "NO" << endl;
	return 0;
}


#include<bits/stdc++.h>
#define ll long long
using namespace std;
inline ll gcd(ll a, ll b) {
	return a == 0 ? b : gcd(b%a, a);
}
int main() {
	int n, m; cin >> n >> m;
	ll ori, lat; scanf("%I64d %I64d", &ori, &lat);
	ll res = lat - ori;
	ll sto = ori;
	if (res != 1) {
		for (int i = 3; i <= n; i++) {
			ori = lat;
			scanf("%I64d", &lat);
			if (lat - ori == 1) {
				res = 1;
				break;
			}
			res = gcd(res, lat - ori);
			if (res == 1) { // gcd����û��1���������1������������
				cout << "NO" << endl;
				return 0;
			}
		}
	}
	int inp;
	for (int i = 1; i <= m; i++) {
		scanf("%I64d", &inp);
		if (res%inp == 0) {
			cout << "YES" << endl;
			printf("%I64d %d", sto, i);
			return 0;
		}
	}
	cout << "NO" << endl;
	return 0;

}


//#include<bits/stdc++.h>
//using namespace std;
//int main(){
//	int n; cin>>n;
//	char s[10005];
//	scanf("%s",s);
//	int cnt=0;
//	for(int i=0;i<n;i++){
//		if(s[i]=='8') cnt++;
//	}
//	int flag=n-11;
//	flag++;
//	flag/=2;
//	if(cnt>flag) cout<<"YES"<<endl;
//	else cout<<"NO"<<endl;
//	return 0;
//}

#include<bits/stdc++.h>
#define ll long long
using namespace std;
const int maxn=3e5+7;
//inline ll gi(){ //����ǿ����Ҳ������cin/ scanf����
//    ll f=1,sum=0;char ch=getchar();
//    while(ch>'9' || ch<'0'){if(ch=='-')f=-1;ch=getchar();}
//    while(ch>='0' && ch<='9'){sum=(sum<<3)+(sum<<1)+ch-'0';ch=getchar();}
//    return f*sum;
//}
inline ll gcd(ll a,ll b){
	return a==0?b:gcd(b%a,a);
}
map<ll,bool> m;
ll a[maxn],b[maxn];
int main(){
	int n,m;
	cin>>n>>m;
	ll inp,ori,ans1;
	ll minn=0x3f3f3f3f;
	scanf("%I64d",&ori);
	ans1=ori;
	scanf("%I64d",&inp);
	int oori=inp-ori;
	ori=inp;
	scanf("%I64d",&inp);
	int nnew=inp-ori;
	int nn=gcd(oori,nnew);
	int oo=nn; //ԭ��gcd
	oori=nnew;
//	ans1=ori;
	ori=inp;
	int flag=1;
	for(int i=4;i<=n;i++){
		scanf("%I64d",&inp);
		nnew=inp-ori;
		if(nnew%oo==0) nn=oo;
		else nn=gcd(oo,nnew);
		if(nn==1){
			cout<<"NO"<<endl;
			return 0;
		}
		oo=nn;
		ori=inp;
	}
	for(int i=1;i<=m;i++){
		scanf("%I64d",&inp);
		if(oo%inp==0){
			cout<<"YES"<<endl;
			cout<<ans1<<" "<<i<<endl;
			return 0;
		}
	}
	cout<<"NO"<<endl;
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define maxz -0x3f3f3f
#define minz 0x3f3f3f

ll gcd(ll a, ll b)
{
    return b == 0 ? a : gcd(b, a%b);
}

int main()
{
    std::ios::sync_with_stdio(false);
    int n, m;
    ll x, z;
    ll p;
    ll y = 0;
    cin >> n >> m;
    cin >> x;
    for(int i = 1; i < n; ++i)
    {
        cin >> z;
        y = gcd(y, z - x);
    }
    for(int i = 1; i <= m; ++i)
    {
        cin >> p;
        if(y % p == 0)
        {
            cout << "YES"<<endl;
            cout << x <<' '<<i<<endl;
            return 0;
        }
    }
    cout << "NO"<<endl;
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define maxz -0x3f3f3f
#define minz 0x3f3f3f

ll gcd(ll a, ll b)
{
    return b == 0 ? a : gcd(b, a%b);
}

int main()
{
    std::ios::sync_with_stdio(false);
    int n, m;
    ll x, z;
    ll p;
    int y = 0;
    cin >> n >> m;
    cin >> x;
    for(int i = 1; i < n; ++i)
    {
        cin >> z;
        y = gcd(y, z - x);
    }
    for(int i = 1; i <= m; ++i)
    {
        cin >> p;
        if(y % p == 0)
        {
            cout << "YES"<<endl;
            cout << x <<' '<<i<<endl;
            return 0;
        }
    }
    cout << "NO"<<endl;
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define maxz -0x3f3f3f
#define minz 0x3f3f3f

ll gcd(ll a, ll b)
{
    return b == 0 ? a : gcd(b, a%b);
}
ll x[400010];
int main()
{
    std::ios::sync_with_stdio(false);
    int n, m;
    ll p;
    ll y = 0;
    cin >> n >> m;
    cin >> x[1]>> x[2];
    y = x[2] - x[1];
    for(int i = 3; i <= n; ++i)
    {
        cin >> x[i];
        y = gcd(y, x[i] - x[i - 1]);
    }
    for(int i = 1; i <= m; ++i)
    {
        cin >> p;
        if(y % p == 0)
        {
            cout << "YES"<<endl;
            cout << x[1] <<' '<<i<<endl;
            return 0;
        }
    }
    cout << "NO"<<endl;
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define maxz -0x3f3f3f
#define minz 0x3f3f3f

ll gcd(ll a, ll b)
{
    return b == 0 ? a : gcd(b, a%b);
}
ll x[100010];
int main()
{
    std::ios::sync_with_stdio(false);
    int n, m;
    ll p;
    int y = 0;
    cin >> n >> m;
    cin >> x[1]>> x[2];
    y = x[2] - x[1];
    for(int i = 3; i <= n; ++i)
    {
        cin >> x[i];
        y = gcd(y, x[i] - x[i - 1]);
    }
    for(int i = 1; i <= m; ++i)
    {
        cin >> p;
        if(y % p == 0)
        {
            cout << "YES"<<endl;
            cout << x[1] <<' '<<i<<endl;
            return 0;
        }
    }
    cout << "NO"<<endl;
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define maxz -0x3f3f3f
#define minz 0x3f3f3f

ll gcd(ll a, ll b)
{
    return b == 0 ? a : gcd(b, a%b);
}
ll x[100010];
int main()
{
    std::ios::sync_with_stdio(false);
    int n, m;
    ll p;
    int y = 0;
    cin >> n >> m;
    cin >> x[1]>> x[2];
    y = x[2] - x[1];
    for(int i = 3; i <= n; ++i)
    {
        cin >> x[i];
        y = gcd(y, x[i] - x[i - 1]);
    }
    for(int i = 1; i <= m; ++i)
    {
        cin >> p;
        if(y % p == 0)
        {
            cout << "YES"<<endl;
            cout << x[1] <<' '<<i<<endl;
            return 0;
        }
    }
    cout << "NO"<<endl;
    return 0;
}
//sdfsd


#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define maxz -0x3f3f3f
#define minz 0x3f3f3f

ll gcd(ll a, ll b)
{
    return b == 0 ? a : gcd(b, a%b);
}
ll x[100010];
int main()
{
    std::ios::sync_with_stdio(false);
    int n, m;
    ll p;
    ll y = 0;
    cin >> n >> m;
    cin >> x[1]>> x[2];
    y = x[2] - x[1];
    for(int i = 3; i <= n; ++i)
    {
        cin >> x[i];
        y = gcd(y, x[i] - x[i - 1]);
    }
    for(int i = 1; i <= m; ++i)
    {
        cin >> p;
        if(y % p == 0)
        {
            cout << "YES"<<endl;
            cout << x[1] <<' '<<i<<endl;
            return 0;
        }
    }
    cout << "NO"<<endl;
    return 0;
}


include<bits/stdc++.h>
using namespace std;
long long int GCD(long long int A, long long int B) {
    if(B==0)
        return A;
    else
        return GCD(B, A % B);
}
int main(){
   long long int n,m,i,c,d=0,j,e;
    cin>>n>>m;
    long long int a[n],b[m];
    for(i=0;i<n;i++){
        cin>>a[i];
    }
    for(j=0;j<m;j++){
        cin>>b[j];
    }
    vector<long long int>v;
    for(i=0;i<n-1;i++){
        v.push_back(a[i+1]-a[i]);
    }
    e=v.size();
    c=GCD(v[0],v[1]);
    for(i=2;i<e;i++){
        c=GCD(c,v[i]);
    }
    for(i=0;i<m;i++){
        if(c%b[i]==0){
            d++;
            cout<<"YES"<<endl;
            cout<<a[0]<<" "<<i+1<<endl;
            break;
        }
    }
    if(d==0){
        cout<<"NO"<<endl;
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
long long int GCD(long long int A, long long int B) {
    if(B==0)
        return A;
    else
        return GCD(B, A % B);
}
int main(){
   long long int n,m,i,c,d=0,j,e;
    cin>>n>>m;
    long long int a[n],b[m];
    for(i=0;i<n;i++){
        cin>>a[i];
    }
    for(j=0;j<m;j++){
        cin>>b[j];
    }
    vector<int>v;
    for(i=0;i<n;i++){
        v.push_back(a[i+1]-a[i]);
    }
    e=v.size();
    c=GCD(v[0],v[1]);
    for(i=2;i<e;i++){
        c=GCD(c,v[i]);
    }
    for(i=0;i<m;i++){
        if(c%b[i]==0){
            d++;
            cout<<"YES"<<endl;
            cout<<a[0]<<" "<<i+1<<endl;
            break;
        }
    }
    if(d==0){
        cout<<"NO"<<endl;
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
long long int GCD(long long int A, long long int B) {
    if(B==0)
        return A;
    else
        return GCD(B, A % B);
}
int main(){
   long long int n,m,i,c,d=0,j,e;
    cin>>n>>m;
    long long int a[n],b[m];
    for(i=0;i<n;i++){
        cin>>a[i];
    }
    for(j=0;j<m;j++){
        cin>>b[j];
    }
    vector<long long int>v;
    for(i=0;i<n-1;i++){
        v.push_back(a[i+1]-a[i]);
    }
    e=v.size();
    if(e==1){
        c=v[0];
    }
    else{
    c=GCD(v[0],v[1]);
    for(i=2;i<e;i++){
        c=GCD(c,v[i]);
    }
    }
    for(i=0;i<m;i++){
        if(c%b[i]==0){
            d++;
            cout<<"YES"<<endl;
            cout<<a[0]<<" "<<i+1<<endl;
            break;
        }
    }
    if(d==0){
        cout<<"NO"<<endl;
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
long long int GCD(long long int A, long long int B) {
    if(B==0)
        return A;
    else
        return GCD(B, A % B);
}
int main(){
   long long int n,m,i,c,d=0,j,e;
    cin>>n>>m;
    long long int a[n],b[m];
    for(i=0;i<n;i++){
        cin>>a[i];
    }
    for(j=0;j<m;j++){
        cin>>b[j];
    }
    vector<int>v;
    for(i=0;i<n-1;i++){
        v.push_back(a[i+1]-a[i]);
    }
    e=v.size();
    c=GCD(v[0],v[1]);
    for(i=2;i<e;i++){
        c=GCD(c,v[i]);
    }
    for(i=0;i<m;i++){
        if(c%b[i]==0){
            d++;
            cout<<"YES"<<endl;
            cout<<a[0]<<" "<<i+1<<endl;
            break;
        }
    }
    if(d==0){
        cout<<"NO"<<endl;
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
int GCD(int A, int B) {
    if(B==0)
        return A;
    else
        return GCD(B, A % B);
}
int main(){
    long int n,m,i,c,d=0,j;
    cin>>n>>m;
    long long int a[n],b[m];
    for(i=0;i<n;i++){
        cin>>a[i];
    }
    for(j=0;j<m;j++){
        cin>>b[j];
    }
    vector<int>v;
    for(i=0;i<n-1;i++){
        v.push_back(a[i+1]-a[i]);
    }
    c=GCD(v[0],v[1]);
    for(i=2;i<n-1;i++){
        c=GCD(c,v[i]);
    }
    for(i=0;i<m;i++){
        if(c%b[i]==0){
            d++;
            cout<<"YES"<<endl;
            cout<<a[0]<<" "<<i+1<<endl;
            break;
        }
    }
    if(d==0){
        cout<<"NO"<<endl;
    }
}


#include<bits/stdc++.h>
using namespace std;
long long int GCD(long long int A, long long int B) {
    if(B==0)
        return A;
    else
        return GCD(B, A % B);
}
int main(){
   long long int n,m,i,c,d=0,j,e;
    cin>>n>>m;
    long long int a[n],b[m];
    for(i=0;i<n;i++){
        cin>>a[i];
    }
    for(j=0;j<m;j++){
        cin>>b[j];
    }
    vector<long long int>v;
    for(i=0;i<n-1;i++){
        v.push_back(a[i+1]-a[i]);
    }
    e=v.size();
    c=GCD(v[0],v[1]);
    for(i=2;i<e;i++){
        c=GCD(c,v[i]);
    }
    for(i=0;i<m;i++){
        if(c%b[i]==0){
            d++;
            cout<<"YES"<<endl;
            cout<<a[0]<<" "<<i+1<<endl;
            break;
        }
    }
    if(d==0){
        cout<<"NO"<<endl;
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
long long int GCD(long long int A, long long int B) {
    if(B==0)
        return A;
    else
        return GCD(B, A % B);
}
int main(){
   long long int n,m,i,c,d=0,j;
    cin>>n>>m;
    long long int a[n],b[m];
    for(i=0;i<n;i++){
        cin>>a[i];
    }
    for(j=0;j<m;j++){
        cin>>b[j];
    }
    vector<int>v;
    for(i=0;i<n-1;i++){
        v.push_back(a[i+1]-a[i]);
    }
    c=GCD(v[0],v[1]);
    for(i=2;i<n-1;i++){
        c=GCD(c,v[i]);
    }
    for(i=0;i<m;i++){
        if(c%b[i]==0){
            d++;
            cout<<"YES"<<endl;
            cout<<a[0]<<" "<<i+1<<endl;
            break;
        }
    }
    if(d==0){
        cout<<"NO"<<endl;
    }
}


#include<iostream>
#include<string>
#include<algorithm>
#include<vector>

using namespace std;

long long gcd(long long a, long long b) {
	if (b == 0)
		return a;
	return gcd(b, a % b);
}

int main() {
	int n, m;
	cin >> n >> m;
	vector<long long>a, b, c;
	for (int i = 0; i < n; i++) {
		long long temp; cin >> temp;
		c.push_back(temp);
	}
	for (int i = 1; i < n; i++) {
		a.push_back(c[i]-c[i-1]);
	}
	for (int i = 0; i < m; i++) {
		long long temp; cin >> temp;
		b.push_back(temp);
	}
	long long gc = a[0];
	for (int i = 1; i < a.size(); i++) {
		gc = gcd(gc, a[i]);
	}
	for (int i = 0; i < b.size(); i++) {
		if (b[i] == gc || gc % b[i] == 0) {
			cout << "YES" << endl;
			cout << a[0] << " " << i + 1 << endl;
			return 0;
		}
	}
	cout << "NO" << endl;
	cin >> gc;
	return 0;
}


#include<iostream>
#include<string>
#include<algorithm>
#include<vector>

using namespace std;

long long gcd(long long a, long long b) {
	if (b == 0)
		return a;
	return gcd(b, a % b);
}

int main() {
	int n, m;
	cin >> n >> m;
	vector<long long>a, b;
	for (int i = 0; i < n; i++) {
		long long temp; cin >> temp;
		a.push_back(temp);
	}
	for (int i = 0; i < m; i++) {
		long long temp; cin >> temp;
		b.push_back(temp);
	}
	long long gc = a[0];
	for (int i = 1; i < n; i++) {
		gc = gcd(gc, a[i]);
	}
	for (int i = 0; i < b.size(); i++) {
		if (b[i] == gc) {
			cout << "YES" << endl;
			cout << a[0] << " " << i + 1 << endl;
			return 0;
		}
	}
	cout << "NO" << endl;
	return 0;
}


#include<iostream>
#include<string>
#include<algorithm>
#include<vector>

using namespace std;

long long gcd(long long a, long long b) {
	if (b == 0)
		return a;
	return gcd(b, a % b);
}

int main() {
	int n, m;
	cin >> n >> m;
	vector<long long>a, b;
	for (int i = 0; i < n; i++) {
		long long temp; cin >> temp;
		a.push_back(temp);
	}
	for (int i = 0; i < m; i++) {
		long long temp; cin >> temp;
		b.push_back(temp);
	}
	long long gc = a[0];
	for (int i = 1; i < n; i++) {
		gc = gcd(gc, a[i]);
	}
	for (int i = 0; i < b.size(); i++) {
		if (b[i] == gc || gc % b[i] == 0) {
			cout << "YES" << endl;
			cout << a[0] << " " << i + 1 << endl;
			return 0;
		}
	}
	cout << "NO" << endl;
	cin >> gc;
	return 0;
}


#include<iostream>
#include<string>
#include<algorithm>
#include<vector>

using namespace std;

long long gcd(long long a, long long b) {
	if (b == 0)
		return a;
	return gcd(b, a % b);
}
long long lcm(long long a, long long b)
{
	return (a*b) / gcd(a, b);
}

int main() {
	int n, m;
	cin >> n >> m;
	vector<long long>a, b, c;
	for (int i = 0; i < n; i++) {
		long long temp; cin >> temp;
		c.push_back(temp);
	}
	for (int i = 1; i < n - 1; i++) {
		a.push_back(c[i] - c[i - 1]);
	}
	for (int i = 0; i < m; i++) {
		long long temp; cin >> temp;
		b.push_back(temp);
	}
	long long gc = a[0];
	long long lc = a[0];
	for (int i = 1; i < a.size(); i++) {
		gc = gcd(gc, a[i]);
		lc = lcm(lc, a[i]);
	}
	for (int i = 0; i < b.size(); i++) {
		if (b[i] == gc || gc % b[i] == 0 || b[i] == lc) {
			cout << "YES" << endl;
			cout << a[0] << " " << i + 1 << endl;
			return 0;
		}
	}
	cout << "NO" << endl;
	cin >> gc;
	return 0;
}


#include<iostream>
#include<string>
#include<algorithm>
#include<vector>

using namespace std;

long long gcd(long long a, long long b) {
	if (b == 0)
		return a;
	return gcd(b, a % b);
}
long long lcm(long long a, long long b)
{
	return (a*b) / gcd(a, b);
}

int main() {
	int n, m;
	cin >> n >> m;
	vector<long long>a, b, c;
	for (int i = 0; i < n; i++) {
		long long temp; cin >> temp;
		c.push_back(temp);
	}
	for (int i = 1; i < n - 1; i++) {
		a.push_back(c[i] - c[i - 1]);
	}
	for (int i = 0; i < m; i++) {
		long long temp; cin >> temp;
		b.push_back(temp);
	}
	long long gc = a[0];
	long long lc = a[0];
	for (int i = 1; i < a.size(); i++) {
		gc = gcd(gc, a[i]);
		lc = lcm(lc, a[i]);
	}
	for (int i = 0; i < b.size(); i++) {
		if (b[i] == gc || gc % b[i] == 0 || b[i] == lc) {
			cout << "YES" << endl;
			cout << c[0] << " " << i + 1 << endl;
			return 0;
		}
	}
	cout << "NO" << endl;
	cin >> gc;
	return 0;
}


#include<iostream>
#include<string>
#include<algorithm>
#include<vector>

using namespace std;

long long gcd(long long a, long long b) {
	if (b == 0)
		return a;
	return gcd(b, a % b);
}

int main() {
	int n, m;
	cin >> n >> m;
	vector<long long>a, b, c;
	for (int i = 0; i < n; i++) {
		long long temp; cin >> temp;
		c.push_back(temp);
	}
	for (int i = 1; i < n; i++) {
		a.push_back(c[i]-c[i-1]);
	}
	for (int i = 0; i < m; i++) {
		long long temp; cin >> temp;
		b.push_back(temp);
	}
	long long gc = a[0];
	for (int i = 1; i < a.size(); i++) {
		gc = gcd(gc, a[i]);
	}
	for (int i = 0; i < b.size(); i++) {
		if (b[i] == gc || gc % b[i] == 0) {
			cout << "YES" << endl;
			cout << c[0] << " " << i + 1 << endl;
			return 0;
		}
	}
	cout << "NO" << endl;
	cin >> gc;
	return 0;
}


//
//  main.cpp
//  Project1155
//
//  Created by Sowmith Manepalli on 4/22/19.
//  Copyright © 2019 Sowmith Manepalli. All rights reserved.
//

#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

long long int gcd(long long int a, long long int b)
{
    // Everything divides 0
    if (a == 0)
        return b;
    if (b == 0)
        return a;

    // base case
    if (a == b)
        return a;

    // a is greater
    if (a > b)
        return gcd(a-b, b);
    return gcd(a, b-a);
}

int main(int argc, const char * argv[]) {
    // insert code here...
    int n,m;
    cin >> n >> m;
    int ans = -1;

    vector<long long int> events;
    vector<long long int> intervals;
    for (int i = 0; i < n; i++) {
        long long int temp; cin >> temp;
        events.push_back(temp);
    }
    for (int i = 0; i < m; i++) {
        long long int temp; cin >> temp;
        intervals.push_back(temp);
    }
    long long int gcd_interm = events[1] - events[0];
    for (int i = 1; i < n; i++) {
        gcd_interm = gcd(gcd_interm, events[i] - events[0]);
        if (gcd_interm == 1) {
            break;
        }
    }
    for (int i = 0; i < m; i++) {
        if (gcd_interm % intervals[i] == 0) {
            ans = i + 1;
            break;
        }
    }
    if (ans == -1) {
        cout << "NO" << endl;
    } else {
        cout << "YES" << endl;
        cout << events[0] << " " << ans << endl;
    }
    return 0;
}


//
//  main.cpp
//  Project1155
//
//  Created by Sowmith Manepalli on 4/22/19.
//  Copyright © 2019 Sowmith Manepalli. All rights reserved.
//

#include <iostream>
#include <vector>
#include <algorithm>
#include <set>

using namespace std;

long long int gcd(long long int a, long long int b)
{
    // Everything divides 0
    if (a == 0)
        return b;
    if (b == 0)
        return a;

    // base case
    if (a == b)
        return a;

    // a is greater
    if (a > b)
        return gcd(a-b, b);
    return gcd(a, b-a);
}

int main(int argc, const char * argv[]) {
    // insert code here...
    int n,m;
    cin >> n >> m;
    int ans = -1;

    set<long long int> events;
    vector<long long int> intervals;
    for (int i = 0; i < n; i++) {
        long long int temp; cin >> temp;
        events.insert(temp);
    }
    for (int i = 0; i < m; i++) {
        long long int temp; cin >> temp;
        intervals.push_back(temp);
    }
    set<long long int>::iterator it = events.begin();
    long long int prev = *it;
    long long int current = *it;
    if (++it != events.end()) {
        current = *it;
    }
    long long int gcd_interm = current - prev;
    for (; it != events.end(); it++) {
        current = *it;
        gcd_interm = gcd(current, prev);
        prev = current;
    }
    for (int i = 0; i < m; i++) {
        if (gcd_interm % intervals[i] == 0) {
            ans = i + 1;
        }
    }
    if (ans == -1) {
        cout << "NO" << endl;
    } else {
        cout << "YES" << endl;
        cout << *(events.begin()) << " " << ans << endl;
    }
    return 0;
}


//
//  main.cpp
//  Project1155
//
//  Created by Sowmith Manepalli on 4/22/19.
//  Copyright © 2019 Sowmith Manepalli. All rights reserved.
//

#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

long long int gcd(long long int a, long long int b)
{
    // Everything divides 0
    if (a == 0)
        return b;
    if (b == 0)
        return a;

    // base case
    if (a == b)
        return a;

    // a is greater
    if (a > b)
        return gcd(a-b, b);
    return gcd(a, b-a);
}

int main(int argc, const char * argv[]) {
    // insert code here...
    int n,m;
    cin >> n >> m;
    int ans = -1;

    vector<long long int> events;
    vector<long long int> intervals;
    for (int i = 0; i < n; i++) {
        long long int temp; cin >> temp;
        events.push_back(temp);
    }
    for (int i = 0; i < m; i++) {
        long long int temp; cin >> temp;
        intervals.push_back(temp);
    }
    long long int gcd_interm = events[1] - events[0];
    for (int i = 1; i < n; i++) {
        gcd_interm = gcd(gcd_interm, events[i] - events[0]);
    }
    for (int i = 0; i < m; i++) {
        if (gcd_interm % intervals[i] == 0) {
            ans = i + 1;
            break;
        }
    }
    if (ans == -1) {
        cout << "NO" << endl;
    } else {
        cout << "YES" << endl;
        cout << events[0] << " " << ans << endl;
    }
    return 0;
}


//
//  main.cpp
//  Project1155
//
//  Created by Sowmith Manepalli on 4/22/19.
//  Copyright © 2019 Sowmith Manepalli. All rights reserved.
//

#include <iostream>
#include <vector>
#include <algorithm>
#include <set>

using namespace std;

int gcd(int a, int b)
{
    // Everything divides 0
    if (a == 0)
        return b;
    if (b == 0)
        return a;

    // base case
    if (a == b)
        return a;

    // a is greater
    if (a > b)
        return gcd(a-b, b);
    return gcd(a, b-a);
}

int main(int argc, const char * argv[]) {
    // insert code here...
    int n,m;
    cin >> n >> m;
    int ans = -1;

    set<int> events;
    vector<int> intervals;
    for (int i = 0; i < n; i++) {
        int temp; cin >> temp;
        events.insert(temp);
    }
    for (int i = 0; i < m; i++) {
        int temp; cin >> temp;
        intervals.push_back(temp);
    }
    set<int>::iterator it = events.begin();
    int prev = *it;
    int current = *it;
    if (++it != events.end()) {
        current = *it;
    }
    int gcd_interm = current - prev;
    for (; it != events.end(); it++) {
        current = *it;
        gcd_interm = gcd(current, prev);
        prev = current;
    }
    for (int i = 0; i < m; i++) {
        if (gcd_interm % intervals[i] == 0) {
            ans = i + 1;
        }
    }
    if (ans == -1) {
        cout << "NO" << endl;
    } else {
        cout << "YES" << endl;
        cout << *(events.begin()) << " " << ans << endl;
    }
    return 0;
}


//
//  main.cpp
//  Project1155
//
//  Created by Sowmith Manepalli on 4/22/19.
//  Copyright © 2019 Sowmith Manepalli. All rights reserved.
//

#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

long long int gcd(long long int a, long long int b)
{
    if (b == 0)
        return a;
    return gcd(b, a % b);

}

int main(int argc, const char * argv[]) {
    // insert code here...
    int n,m;
    cin >> n >> m;
    int ans = -1;

    vector<long long int> events;
    vector<long long int> intervals;
    for (int i = 0; i < n; i++) {
        long long int temp; cin >> temp;
        events.push_back(temp);
    }
    for (int i = 0; i < m; i++) {
        long long int temp; cin >> temp;
        intervals.push_back(temp);
    }
    long long int gcd_interm = events[1] - events[0];
    for (int i = 1; i < n; i++) {
        gcd_interm = gcd(gcd_interm, events[i] - events[0]);
        if (gcd_interm == 1) {
            break;
        }
    }
    for (int i = 0; i < m; i++) {
        if (gcd_interm % intervals[i] == 0) {
            ans = i + 1;
            break;
        }
    }
    if (ans == -1) {
        cout << "NO" << endl;
    } else {
        cout << "YES" << endl;
        cout << events[0] << " " << ans << endl;
    }
    return 0;
}


//
//  main.cpp
//  Project1155
//
//  Created by Sowmith Manepalli on 4/22/19.
//  Copyright © 2019 Sowmith Manepalli. All rights reserved.
//

#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int gcd(int a, int b)
{
    // Everything divides 0
    if (a == 0)
        return b;
    if (b == 0)
        return a;

    // base case
    if (a == b)
        return a;

    // a is greater
    if (a > b)
        return gcd(a-b, b);
    return gcd(a, b-a);
}

int main(int argc, const char * argv[]) {
    // insert code here...
    int n,m;
    cin >> n >> m;
    int ans = -1;

    vector<int> events;
    vector<int> intervals;
    for (int i = 0; i < n; i++) {
        int temp; cin >> temp;
        events.push_back(temp);
    }
    for (int i = 0; i < m; i++) {
        int temp; cin >> temp;
        intervals.push_back(temp);
    }
    sort(events.begin(), events.end());
    int gcd_interm = events[1] - events[0];
    for (int i = 1; i < n; i++) {
        gcd_interm = gcd(gcd_interm, events[i] - events[0]);
    }
    for (int i = 0; i < m; i++) {
        if (gcd_interm % intervals[i] == 0) {
            ans = i + 1;
        }
    }
    if (ans == -1) {
        cout << "NO" << endl;
    } else {
        cout << "YES" << endl;
        cout << events[0] << " " << ans << endl;
    }
    return 0;
}


//
//  main.cpp
//  Project1155
//
//  Created by Sowmith Manepalli on 4/22/19.
//  Copyright © 2019 Sowmith Manepalli. All rights reserved.
//

#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

long long int gcd(long long int a, long long int b)
{
    // Everything divides 0
    if (a == 0)
        return b;
    if (b == 0)
        return a;

    // base case
    if (a == b)
        return a;

    // a is greater
    if (a > b)
        return gcd(a-b, b);
    return gcd(a, b-a);
}

int main(int argc, const char * argv[]) {
    // insert code here...
    int n,m;
    cin >> n >> m;
    int ans = -1;

    vector<long long int> events;
    vector<long long int> intervals;
    for (int i = 0; i < n; i++) {
        long long int temp; cin >> temp;
        events.push_back(temp);
    }
    for (int i = 0; i < m; i++) {
        long long int temp; cin >> temp;
        intervals.push_back(temp);
    }
    long long int gcd_interm = events[1] - events[0];
    for (int i = 1; i < n; i++) {
        gcd_interm = gcd(gcd_interm, events[i] - events[0]);
    }
    for (int i = 0; i < m; i++) {
        if (gcd_interm % intervals[i] == 0) {
            ans = i + 1;
        }
    }
    if (ans == -1) {
        cout << "NO" << endl;
    } else {
        cout << "YES" << endl;
        cout << events[0] << " " << ans << endl;
    }
    return 0;
}


#include <iostream>
#include <iomanip>
#include <algorithm>
#include <queue>
#include <vector>
#include <string>
#include <math.h>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;

const int N = 500000;
ll a[N], b[N];

ll gcd (ll a, ll b) {
	if (a < b) swap(a, b);
	if (!b)
		return a;
	else
		return gcd(b, a % b);
}

int main () {
	int n, m;
	cin >> n >> m;
	for (int i = 1;i <= n;i++) cin >> a[i];
	for (int i = 1;i <= m;i++) cin >> b[i];
	ll k = a[2] - a[1];
	for (int i = 2;i < n;i++) {
		ll t = a[i + 1] - a[i];
		k = gcd(k, t);
	}
	for (int i = 1;i <= m;i++)
		if (k % b[i] == 0) {
			cout << "YES" << endl;
			cout << a[1] << ' ' << i;
			return 0;
		}
	cout << "NO" << endl;
}


#include <bits/stdc++.h>
using namespace std;

#define PI 3.1415926536
#define MOD 1000000007
#define ull unsigned long long
#define ll long long int
#define pb push_back
#define fio() ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)

int main()
{
    #ifndef ONLINE_JUDGE
    freopen ("in.txt", "r", stdin);
    //freopen ("out.txt", "w", stdout);
    #endif
    long long int n, m, x[300010], p[300010], i, first, j, k, f, ans, l, g=0;
    cin>>n>>m;
    for(i=0;i<n;i++)cin>>x[i];
    for(i=0;i<m;i++)cin>>p[i];

      first=x[0];
      for(k=0;k<m;k++){
      	f=0;
    	for(j=0;j<n;j++){
    		if((x[j]-first)%p[k]!=0){
    			f=1;
    			break;
    		}
    	}
    	if(f==0) {
    	    g=1;
            ans=k+1;
            break;
    	}
      }

    if(g==0)cout<<"NO"<<endl;
    else{
    	cout<<"YES"<<endl<<first<<" "<<ans<<endl;
    }
    return 0;
}


#include <bits/stdc++.h>
using namespace std;

#define PI 3.1415926536
#define MOD 1000000007
#define ull unsigned long long
#define ll long long int
#define pb push_back
#define fio() ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)

int main()
{
    #ifndef ONLINE_JUDGE
    freopen ("in.txt", "r", stdin);
    freopen ("out.txt", "w", stdout);
    #endif
    long long n, m, x[300010], p[300010], gcd, f=0, i, first, ans;
    cin>>n>>m;
    for(i=0;i<n;i++)cin>>x[i];
    for(i=0;i<m;i++)cin>>p[i];
    first=x[0];
    for(i=0;i<n-1;i++)x[i]=x[i+1]-x[i];
    gcd=x[0];
    for(i=1;i<n-1;i++)gcd=__gcd(gcd,x[i]);
    for(i=0;i<m;i++){
    	if(gcd%p[i]==0){
    		ans=i+1;
    		f=1;break;
    	}
    }
    if(f)cout<<"YES"<<endl<<first<<" "<<ans<<endl;
    else cout<<"NO"<<endl;
    return 0;
}


#include <bits/stdc++.h>
using namespace std;

#define PI 3.1415926536
#define MOD 1000000007
#define ull unsigned long long
#define ll long long int
#define pb push_back
#define fio() ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)

int main()
{
    #ifndef ONLINE_JUDGE
    freopen ("in.txt", "r", stdin);
    freopen ("out.txt", "w", stdout);
    #endif
    long long int n, m, x[100010], p[100010], i, first, j, f, ans, l=0, gcd, g, index, mn;
    cin>>n>>m;
    vector <int> v;
    vector<int>::iterator it;
    for(i=0;i<n;i++)cin>>x[i];
    for(i=0;i<m;i++){
    	cin>>p[i];
    	v.pb(p[i]);
    }
    for(i=1;i<=x[0];i++){
    first=i,j=1,f=0,g=x[j]-first;
    mn=1000000000000000000;
    	if(x[0]%first==0){
      		for(;j<n-1;j++){
      			gcd=__gcd(g,x[j+1]-first);
      			g=gcd;
      			if(gcd<mn) mn=gcd;
      		}
    	}
      		if(find(v.begin(), v.end(), mn) != v.end()){
      			l=1;
      			break;
      		}
    }
    for(i=0;i<m;i++){
    	if(p[i]==mn){
    		ans=i+1;
    		break;
    	}
    }
    if(l==0)cout<<"NO"<<endl;
    else cout<<"YES"<<endl<<first<<" "<<ans<<endl;
    return 0;
}


#include <bits/stdc++.h>
using namespace std;

#define PI 3.1415926536
#define MOD 1000000007
#define ull unsigned long long
#define ll long long int
#define pb push_back
#define fio() ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)

int main()
{
    #ifndef ONLINE_JUDGE
    freopen ("in.txt", "r", stdin);
    //freopen ("out.txt", "w", stdout);
    #endif
    int n, m, x[300010], p[300010], i, first, j, k, f, ans, l, g=0;
    cin>>n>>m;
    for(i=0;i<n;i++)cin>>x[i];
    for(i=0;i<m;i++)cin>>p[i];
    for(i=1;i<=x[0];i++){
    first=i;
      for(k=0;k<m;k++){
      	f=0;
    	for(j=0;j<n;j++){
    		if((x[j]-first)%p[k]!=0){
    			f=1;
    			break;
    		}
    	}
    	if(f==0) break;
      }
      if(f==0){
      	ans=k+1;
    	g=1;
    	break;
      }
    }

    if(g==0)cout<<"NO"<<endl;
    else{
    	cout<<"YES"<<endl<<first<<" "<<ans<<endl;
    }
    return 0;
}


#include <bits/stdc++.h>
using namespace std;

#define PI 3.1415926536
#define MOD 1000000007
#define ull unsigned long long
#define ll long long int
#define pb push_back
#define fio() ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)

int main()
{
    #ifndef ONLINE_JUDGE
    freopen ("in.txt", "r", stdin);
    freopen ("out.txt", "w", stdout);
    #endif
    long long int n, m, x[300010], p[300010], i, first, j, f, ans, l=0, gcd, g, index, mn;
    cin>>n>>m;
    vector <int> v;
    vector<int>::iterator it;
    for(i=0;i<n;i++)cin>>x[i];
    for(i=0;i<m;i++){
    	cin>>p[i];
    	v.pb(p[i]);
    }
    for(i=1;i<=x[0];i++){
    first=i,j=1,f=0,g=x[j]-first;
    mn=1000000000000000000;
    	if(x[0]%first==0){
      		for(;j<n-1;j++){
      			gcd=__gcd(g,x[j+1]-first);
      			g=gcd;
      			if(gcd<mn) mn=gcd;
      		}
    	}
      		if(find(v.begin(), v.end(), mn) != v.end()){
      			l=1;
      			break;
      		}
    }
    for(i=0;i<m;i++){
    	if(p[i]==mn){
    		ans=i+1;
    		break;
    	}
    }
    if(l==0)cout<<"NO"<<endl;
    else cout<<"YES"<<endl<<first<<" "<<ans<<endl;
    return 0;
}


#include <bits/stdc++.h>
using namespace std;

#define PI 3.1415926536
#define MOD 1000000007
#define ull unsigned long long
#define ll long long int
#define pb push_back
#define fio() ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)

int main()
{
    #ifndef ONLINE_JUDGE
    freopen ("in.txt", "r", stdin);
    //freopen ("out.txt", "w", stdout);
    #endif
    long long int n, m, x[300010], p[300010], i, first, j, k, f, ans, l, g=0;
    cin>>n>>m;
    for(i=0;i<n;i++)cin>>x[i];
    for(i=0;i<m;i++)cin>>p[i];
    for(i=1;i<=x[0];i++){
    first=i;
      for(k=0;k<m;k++){
      	f=0;
    	for(j=0;j<n;j++){
    		if((x[j]-first)%p[k]!=0){
    			f=1;
    			break;
    		}
    	}
    	if(f==0) break;
      }
      if(f==0){
      	ans=k+1;
    	g=1;
    	break;
      }
    }

    if(g==0)cout<<"NO"<<endl;
    else{
    	cout<<"YES"<<endl<<first<<" "<<ans<<endl;
    }
    return 0;
}


#include<iostream>
#include<string>
#include<algorithm>
#include<map>
#include<set>
#include<vector>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<queue>
#include<utility>
#include<sstream>
using namespace std;

#define sf scanf
#define pf printf
#define pfn printf("\n");
#define ll long long
#define sfd(n) scanf("%d",&n);
#define sfld(n) scanf("%lld",&n);
#define sflf(n) scanf("%lf",&n);
#define sfc(n) scanf("%c",&n);
#define sfs(n) scanf("%s",&n);
#define pfd(n) printf("%d",n);
#define pfld(n) printf("%lld",n);
#define pflf(n) printf("%lf",n);
#define pfc(n) printf("%c",n);
#define pfs(n) printf("%s",n);

#define csh(a,n) memset(a,n,sizeof(a));
ll arr[300002];
map<ll,int>brr;
ll crr[300001];
ll GCD(ll a,ll b)
{
	return b==0?a:GCD(b,a%b);
}
ll *sushubiao()
{
	ll i,j;
	ll MAX=0x3f3f3f;				//0x3f3f3f=1061109567
	ll *shu= new ll [MAX];
	ll *sushu= new ll [292676];	//一共有292676个素数
	for(i=0;i<MAX;i++)
		shu[i]=1;
	ll count=0;
	for(i=2;i<MAX;i++)
	{
		if(shu[i]==1)
		{
			for(j=2;j*i<MAX;j++)
			{
				shu[i*j]=0;
			}
			sushu[count++]=i;

		}
	}
	delete[] shu;				//释放数组shu的内存
	return sushu;
}
int main()
{
	ll n,m;
	ll f;
	cin>>n>>m;
	for(int i=0;i<n;i++)
	{
		cin>>arr[i];
	}
	for(int i=0;i<n-1;i++)
	{
		crr[i]=arr[i+1]-arr[i];
	}
	ll sum=crr[0];
	for(int i=1;i<n-1;i++)
	{
		sum=GCD(sum,crr[i]);
	}
	for(int i=1;i<=m;i++)
	{
		cin>>f;
		brr[f]=i;
	}
	ll *p=sushubiao();
	ll i=0;
	if(brr[sum])
	{
		cout<<"YES"<<endl<<arr[0]<<" "<<brr[sum]<<endl;
		return 0;
	}
	else{
		while(1)
		{
			if(sum<p[i])
			{
				break;
			}
			if(sum%p[i]==0)
			{
				sum/=p[i];
				if(brr[sum])
				{
					cout<<"YES"<<endl<<arr[0]<<" "<<brr[sum]<<endl;
					return 0;
				}
				i--;
			}
			i++;
		}
	}
	cout<<"NO"<<endl;
	return 0;
}


#include<iostream>
#include<string>
#include<algorithm>
#include<map>
#include<set>
#include<vector>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<queue>
#include<utility>
#include<sstream>
using namespace std;

#define sf scanf
#define pf printf
#define pfn printf("\n");
#define ll long long
#define sfd(n) scanf("%d",&n);
#define sfld(n) scanf("%lld",&n);
#define sflf(n) scanf("%lf",&n);
#define sfc(n) scanf("%c",&n);
#define sfs(n) scanf("%s",&n);
#define pfd(n) printf("%d",n);
#define pfld(n) printf("%lld",n);
#define pflf(n) printf("%lf",n);
#define pfc(n) printf("%c",n);
#define pfs(n) printf("%s",n);

#define csh(a,n) memset(a,n,sizeof(a));
ll arr[300010];
map<ll,int>brr;
ll crr[300010];
ll GCD(ll a,ll b)
{
	return b==0?a:GCD(b,a%b);
}
int *sushubiao()
{
	int i,j;
	int MAX=0x3f3f3f;				//0x3f3f3f=1061109567
	int *shu= new int [MAX];
	int *sushu= new int [292676];	//一共有292676个素数
	for(i=0;i<MAX;i++)
		shu[i]=1;
	int count=0;
	for(i=2;i<MAX;i++)
	{
		if(shu[i]==1)
		{
			for(j=2;j*i<MAX;j++)
			{
				shu[i*j]=0;
			}
			sushu[count++]=i;

		}
	}
	delete[] shu;				//释放数组shu的内存
	return sushu;
}

int main()
{
	ll n,m;
	ll f;
	cin>>n>>m;
	for(int i=0;i<n;i++)
	{
		cin>>arr[i];
	}
	for(int i=0;i<n-1;i++)
	{
		crr[i]=arr[i+1]-arr[i];
	}
	ll sum=crr[0];
	for(int i=1;i<n-1;i++)
	{
		sum=GCD(sum,crr[i]);
	}
	for(int i=1;i<=m;i++)
	{
		cin>>f;
		brr[f]=i;
	}
	int *p=sushubiao();
	int i=0;
	for(map<ll,int>::iterator i=brr.begin();i!=brr.end();i++)
	{
		if(sum%(i->first)==0)
		{
			cout<<"YES"<<endl<<arr[0]<<" "<<i->second<<endl;
			return 0;
		}
	}
	cout<<"NO"<<endl;
	return 0;
}


#include<iostream>
#include<string>
#include<algorithm>
#include<map>
#include<set>
#include<vector>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<queue>
#include<utility>
#include<sstream>
using namespace std;

#define sf scanf
#define pf printf
#define pfn printf("\n");
#define ll long long
#define sfd(n) scanf("%d",&n);
#define sfld(n) scanf("%lld",&n);
#define sflf(n) scanf("%lf",&n);
#define sfc(n) scanf("%c",&n);
#define sfs(n) scanf("%s",&n);
#define pfd(n) printf("%d",n);
#define pfld(n) printf("%lld",n);
#define pflf(n) printf("%lf",n);
#define pfc(n) printf("%c",n);
#define pfs(n) printf("%s",n);

#define csh(a,n) memset(a,n,sizeof(a));
ll arr[300002];
map<ll,int>brr;
ll crr[300001];
ll GCD(ll a,ll b)
{
	return b==0?a:GCD(b,a%b);
}
int *sushubiao()
{
	int i,j;
	int MAX=0x3f3f3f;				//0x3f3f3f=1061109567
	int *shu= new int [MAX];
	int *sushu= new int [292676];	//一共有292676个素数
	for(i=0;i<MAX;i++)
		shu[i]=1;
	int count=0;
	for(i=2;i<MAX;i++)
	{
		if(shu[i]==1)
		{
			for(j=2;j*i<MAX;j++)
			{
				shu[i*j]=0;
			}
			sushu[count++]=i;

		}
	}
	delete[] shu;				//释放数组shu的内存
	return sushu;
}
int main()
{
	int n,m;
	ll f;
	sfd(n)
	sfd(m)
	for(int i=0;i<n;i++)
	{
		cin>>arr[i];
	}
	for(int i=0;i<n-1;i++)
	{
		crr[i]=arr[i+1]-arr[i];
	}
	ll sum=crr[0];
	for(int i=1;i<n-1;i++)
	{
		sum=GCD(sum,crr[i]);
	}
	for(int i=1;i<=m;i++)
	{
		cin>>f;
		brr[f]=i;
	}
	int *p=sushubiao();
	int i=0;
	if(brr[sum]>0)
	{
		cout<<"YES"<<endl<<arr[0]<<" "<<brr[sum]<<endl;
		return 0;
	}
	else{
		while(1)
		{
			if(sum<p[i])
			{
				break;
			}
			if(sum%p[i]==0)
			{
				sum/=p[i];
				if(brr[sum])
				{
					cout<<"YES"<<endl<<arr[0]<<" "<<brr[sum]<<endl;
					return 0;
				}
			}
			i++;
		}
	}
	cout<<"NO"<<endl;
	return 0;
}


#include<iostream>
#include<string>
#include<algorithm>
#include<map>
#include<set>
#include<vector>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<queue>
#include<utility>
#include<sstream>
using namespace std;

#define sf scanf
#define pf printf
#define pfn printf("\n");
#define ll long long
#define sfd(n) scanf("%d",&n);
#define sfld(n) scanf("%lld",&n);
#define sflf(n) scanf("%lf",&n);
#define sfc(n) scanf("%c",&n);
#define sfs(n) scanf("%s",&n);
#define pfd(n) printf("%d",n);
#define pfld(n) printf("%lld",n);
#define pflf(n) printf("%lf",n);
#define pfc(n) printf("%c",n);
#define pfs(n) printf("%s",n);

#define csh(a,n) memset(a,n,sizeof(a));
ll arr[300002];
map<ll,int>brr;
ll crr[300001];
ll GCD(ll a,ll b)
{
	return b==0?a:GCD(b,a%b);
}
ll *sushubiao()
{
	ll i,j;
	ll MAX=0x3f3f3f;				//0x3f3f3f=1061109567
	ll *shu= new ll [MAX];
	ll *sushu= new ll [292676];	//一共有292676个素数
	for(i=0;i<MAX;i++)
		shu[i]=1;
	ll count=0;
	for(i=2;i<MAX;i++)
	{
		if(shu[i]==1)
		{
			for(j=2;j*i<MAX;j++)
			{
				shu[i*j]=0;
			}
			sushu[count++]=i;

		}
	}
	delete[] shu;				//释放数组shu的内存
	return sushu;
}
int main()
{
	ll n,m;
	ll f;
	cin>>n>>m;
	for(int i=0;i<n;i++)
	{
		cin>>arr[i];
	}
	for(int i=0;i<n-1;i++)
	{
		crr[i]=arr[i+1]-arr[i];
	}
	ll sum=crr[0];
	for(int i=1;i<n-1;i++)
	{
		sum=GCD(sum,crr[i]);
	}
	for(int i=1;i<=m;i++)
	{
		cin>>f;
		brr[f]=i;
	}
	ll *p=sushubiao();
	ll i=0;
	if(brr[sum])
	{
		cout<<"YES"<<endl<<arr[0]<<" "<<brr[sum]<<endl;
		return 0;
	}
	else{
		while(1)
		{
			if(sum<p[i])
			{
				break;
			}
			if(sum%p[i]==0)
			{
				if(brr[sum])
				{
					cout<<"YES"<<endl<<arr[0]<<" "<<brr[sum]<<endl;
					return 0;
				}
				i--;
			}
			i++;
		}
	}
	cout<<"NO"<<endl;
	return 0;
}


#include<iostream>
#include<string>
#include<algorithm>
#include<map>
#include<set>
#include<vector>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<queue>
#include<utility>
#include<sstream>
using namespace std;

#define sf scanf
#define pf printf
#define pfn printf("\n");
#define ll long long
#define sfd(n) scanf("%d",&n);
#define sfld(n) scanf("%lld",&n);
#define sflf(n) scanf("%lf",&n);
#define sfc(n) scanf("%c",&n);
#define sfs(n) scanf("%s",&n);
#define pfd(n) printf("%d",n);
#define pfld(n) printf("%lld",n);
#define pflf(n) printf("%lf",n);
#define pfc(n) printf("%c",n);
#define pfs(n) printf("%s",n);

#define csh(a,n) memset(a,n,sizeof(a));
ll arr[300010];
map<ll,int>brr;
ll crr[300010];
ll GCD(ll a,ll b)
{
	return b==0?a:GCD(b,a%b);
}
int *sushubiao()
{
	int i,j;
	int MAX=0x3f3f3f;				//0x3f3f3f=1061109567
	int *shu= new int [MAX];
	int *sushu= new int [292676];	//一共有292676个素数
	for(i=0;i<MAX;i++)
		shu[i]=1;
	int count=0;
	for(i=2;i<MAX;i++)
	{
		if(shu[i]==1)
		{
			for(j=2;j*i<MAX;j++)
			{
				shu[i*j]=0;
			}
			sushu[count++]=i;

		}
	}
	delete[] shu;				//释放数组shu的内存
	return sushu;
}

int main()
{
	ll n,m;
	ll f;
	cin>>n>>m;
	for(int i=0;i<n;i++)
	{
		cin>>arr[i];
	}
	for(int i=0;i<n-1;i++)
	{
		crr[i]=arr[i+1]-arr[i];
	}
	ll sum=crr[0];
	for(int i=1;i<n-1;i++)
	{
		sum=GCD(sum,crr[i]);
	}
	for(int i=1;i<=m;i++)
	{
		cin>>f;
		brr[f]=i;
	}
	int *p=sushubiao();
	int i=0;
	if(brr[sum])
	{
		cout<<"YES"<<endl<<arr[0]<<" "<<brr[sum]<<endl;
		return 0;
	}
	else{
		while(1)
		{
			if(sum<p[i])
			{
				break;
			}
			if(sum%p[i]==0)
			{
				sum/=p[i];
				if(brr[sum])
				{
					cout<<"YES"<<endl<<arr[0]<<" "<<brr[sum]<<endl;
					return 0;
				}
				if(brr[p[i]])
				{
					cout<<"YES"<<endl<<arr[0]<<" "<<brr[p[i]]<<endl;
					return 0;
				}
				i--;
			}
			i++;
		}
	}
	cout<<"NO"<<endl;
	return 0;
}


#include<iostream>
#include<string>
#include<algorithm>
#include<map>
#include<set>
#include<vector>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<queue>
#include<utility>
#include<sstream>
using namespace std;

#define sf scanf
#define pf printf
#define pfn printf("\n");
#define ll long long
#define sfd(n) scanf("%d",&n);
#define sfld(n) scanf("%lld",&n);
#define sflf(n) scanf("%lf",&n);
#define sfc(n) scanf("%c",&n);
#define sfs(n) scanf("%s",&n);
#define pfd(n) printf("%d",n);
#define pfld(n) printf("%lld",n);
#define pflf(n) printf("%lf",n);
#define pfc(n) printf("%c",n);
#define pfs(n) printf("%s",n);

#define csh(a,n) memset(a,n,sizeof(a));
ll arr[300002];
map<ll,ll>brr;
ll crr[300001];
ll GCD(ll a,ll b)
{
	return b==0?a:GCD(b,a%b);
}
ll *sushubiao()
{
	ll i,j;
	ll MAX=0x3f3f3f;				//0x3f3f3f=1061109567
	ll *shu= new ll [MAX];
	ll *sushu= new ll [292676];	//一共有292676个素数
	for(i=0;i<MAX;i++)
		shu[i]=1;
	ll count=0;
	for(i=2;i<MAX;i++)
	{
		if(shu[i]==1)
		{
			for(j=2;j*i<MAX;j++)
			{
				shu[i*j]=0;
			}
			sushu[count++]=i;

		}
	}
	delete[] shu;				//释放数组shu的内存
	return sushu;
}
ll main()
{
	ll n,m;
	ll f;
	sfd(n)
	sfd(m)
	for(ll i=0;i<n;i++)
	{
		cin>>arr[i];
	}
	for(ll i=0;i<n-1;i++)
	{
		crr[i]=arr[i+1]-arr[i];
	}
	ll sum=crr[0];
	for(ll i=1;i<n-1;i++)
	{
		sum=GCD(sum,crr[i]);
	}
	for(ll i=1;i<=m;i++)
	{
		cin>>f;
		brr[f]=i;
	}
	ll *p=sushubiao();
	ll i=0;
	if(brr[sum]>0)
	{
		cout<<"YES"<<endl<<arr[0]<<" "<<brr[sum]<<endl;
		return 0;
	}
	else{
		sum/=p[i];
		if(brr[sum])
		{
			cout<<"YES"<<endl<<arr[0]<<" "<<brr[sum]<<endl;
			return 0;
		}
	}
	cout<<"NO"<<endl;
	return 0;
}


#include<iostream>
#include<string>
#include<algorithm>
#include<map>
#include<set>
#include<vector>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<queue>
#include<utility>
#include<sstream>
using namespace std;

#define sf scanf
#define pf printf
#define pfn printf("\n");
#define ll long long
#define sfd(n) scanf("%d",&n);
#define sfld(n) scanf("%lld",&n);
#define sflf(n) scanf("%lf",&n);
#define sfc(n) scanf("%c",&n);
#define sfs(n) scanf("%s",&n);
#define pfd(n) printf("%d",n);
#define pfld(n) printf("%lld",n);
#define pflf(n) printf("%lf",n);
#define pfc(n) printf("%c",n);
#define pfs(n) printf("%s",n);

#define csh(a,n) memset(a,n,sizeof(a));
ll arr[300002];
map<ll,int>brr;
ll crr[300001];
ll GCD(ll a,ll b)
{
	return b==0?a:GCD(b,a%b);
}
int *sushubiao()
{
	int i,j;
	int MAX=0x3f3f3f;				//0x3f3f3f=1061109567
	int *shu= new int [MAX];
	int *sushu= new int [292676];	//一共有292676个素数
	for(i=0;i<MAX;i++)
		shu[i]=1;
	int count=0;
	for(i=2;i<MAX;i++)
	{
		if(shu[i]==1)
		{
			for(j=2;j*i<MAX;j++)
			{
				shu[i*j]=0;
			}
			sushu[count++]=i;

		}
	}
	delete[] shu;				//释放数组shu的内存
	return sushu;
}

int main()
{
	ll n,m;
	ll f;
	cin>>n>>m;
	for(int i=0;i<n;i++)
	{
		cin>>arr[i];
	}
	for(int i=0;i<n-1;i++)
	{
		crr[i]=arr[i+1]-arr[i];
	}
	ll sum=crr[0];
	for(int i=1;i<n-1;i++)
	{
		sum=GCD(sum,crr[i]);
	}
	for(int i=1;i<=m;i++)
	{
		cin>>f;
		brr[f]=i;
	}
	int *p=sushubiao();
	int i=0;
	if(brr[sum])
	{
		cout<<"YES"<<endl<<arr[0]<<" "<<brr[sum]<<endl;
		return 0;
	}
	else{
		while(1)
		{
			if(sum<p[i])
			{
				break;
			}
			if(sum%p[i]==0)
			{
				sum/=p[i];
				if(brr[sum])
				{
					cout<<"YES"<<endl<<arr[0]<<" "<<brr[sum]<<endl;
					return 0;
				}
				i--;
			}
			i++;
		}
	}
	cout<<"NO"<<endl;
	return 0;
}


#include<iostream>
#include<string>
#include<algorithm>
#include<map>
#include<set>
#include<vector>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<queue>
#include<utility>
#include<sstream>
using namespace std;

#define sf scanf
#define pf printf
#define pfn printf("\n");
#define ll long long
#define sfd(n) scanf("%d",&n);
#define sfld(n) scanf("%lld",&n);
#define sflf(n) scanf("%lf",&n);
#define sfc(n) scanf("%c",&n);
#define sfs(n) scanf("%s",&n);
#define pfd(n) printf("%d",n);
#define pfld(n) printf("%lld",n);
#define pflf(n) printf("%lf",n);
#define pfc(n) printf("%c",n);
#define pfs(n) printf("%s",n);

#define csh(a,n) memset(a,n,sizeof(a));
ll arr[300010];
map<ll,int>brr;
ll crr[300010];
ll GCD(ll a,ll b)
{
	return b==0?a:GCD(b,a%b);
}
int *sushubiao()
{
	int i,j;
	int MAX=0x3f3f3f;				//0x3f3f3f=1061109567
	int *shu= new int [MAX];
	int *sushu= new int [292676];	//一共有292676个素数
	for(i=0;i<MAX;i++)
		shu[i]=1;
	int count=0;
	for(i=2;i<MAX;i++)
	{
		if(shu[i]==1)
		{
			for(j=2;j*i<MAX;j++)
			{
				shu[i*j]=0;
			}
			sushu[count++]=i;

		}
	}
	delete[] shu;				//释放数组shu的内存
	return sushu;
}

int main()
{
	ll n,m;
	ll f;
	cin>>n>>m;
	for(int i=0;i<n;i++)
	{
		cin>>arr[i];
	}
	for(int i=0;i<n-1;i++)
	{
		crr[i]=arr[i+1]-arr[i];
	}
	ll sum=crr[0];
	for(int i=1;i<n-1;i++)
	{
		sum=GCD(sum,crr[i]);
	}
	for(int i=1;i<=m;i++)
	{
		cin>>f;
		brr[f]=i;
	}
	int *p=sushubiao();
	int i=0;
	if(brr[sum])
	{
		cout<<"YES"<<endl<<arr[0]<<" "<<brr[sum]<<endl;
		return 0;
	}
	else{
		while(1)
		{
			if(sum<p[i])
			{
				break;
			}
			if(sum%p[i]==0)
			{
				ll pp=p[i];
				while(1)
				{
					if(sum%p[i]==0)
					{
						sum/=p[i];
						if(brr[sum])
						{
							cout<<"YES"<<endl<<arr[0]<<" "<<brr[sum]<<endl;
							return 0;
						}
						if(brr[pp])
						{
							cout<<"YES"<<endl<<arr[0]<<" "<<brr[pp]<<endl;
							return 0;
						}
					}
					pp*=p[i];
				}
			}
			i++;
		}
	}
	cout<<"NO"<<endl;
	return 0;
}


#include<iostream>
#include<string>
#include<algorithm>
#include<map>
#include<set>
#include<vector>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<queue>
#include<utility>
#include<sstream>
using namespace std;

#define sf scanf
#define pf printf
#define pfn printf("\n");
#define ll long long
#define sfd(n) scanf("%d",&n);
#define sfld(n) scanf("%lld",&n);
#define sflf(n) scanf("%lf",&n);
#define sfc(n) scanf("%c",&n);
#define sfs(n) scanf("%s",&n);
#define pfd(n) printf("%d",n);
#define pfld(n) printf("%lld",n);
#define pflf(n) printf("%lf",n);
#define pfc(n) printf("%c",n);
#define pfs(n) printf("%s",n);

#define csh(a,n) memset(a,n,sizeof(a));
ll arr[300002];
map<ll,int>brr;
ll crr[300001];
ll GCD(ll a,ll b)
{
	return b==0?a:GCD(b,a%b);
}
ll *sushubiao()
{
	ll i,j;
	ll MAX=0x3f3f3f;				//0x3f3f3f=1061109567
	ll *shu= new ll [MAX];
	ll *sushu= new ll [292676];	//一共有292676个素数
	for(i=0;i<MAX;i++)
		shu[i]=1;
	ll count=0;
	for(i=2;i<MAX;i++)
	{
		if(shu[i]==1)
		{
			for(j=2;j*i<MAX;j++)
			{
				shu[i*j]=0;
			}
			sushu[count++]=i;

		}
	}
	delete[] shu;				//释放数组shu的内存
	return sushu;
}
int main()
{
	ll n,m;
	ll f;
	cin>>n>>m;
	for(int i=0;i<n;i++)
	{
		cin>>arr[i];
	}
	for(int i=0;i<n-1;i++)
	{
		crr[i]=arr[i+1]-arr[i];
	}
	ll sum=crr[0];
	for(int i=1;i<n-1;i++)
	{
		sum=GCD(sum,crr[i]);
	}
	for(int i=1;i<=m;i++)
	{
		cin>>f;
		brr[f]=i;
	}
	ll *p=sushubiao();
	ll i=0;
	if(brr[sum])
	{
		cout<<"YES"<<endl<<arr[0]<<" "<<brr[sum]<<endl;
		return 0;
	}
	else{
		while(1)
		{
			if(sum<p[i])
			{
				break;
			}
			if(sum%p[i]==0)
			{
				sum/=p[i];
				if(brr[sum])
				{
					cout<<"YES"<<endl<<arr[0]<<" "<<brr[sum]<<endl;
					return 0;
				}
			}
			i++;
		}
	}
	cout<<"NO"<<endl;
	return 0;
}


#include<iostream>
#include<string>
#include<algorithm>
#include<map>
#include<set>
#include<vector>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<queue>
#include<utility>
#include<sstream>
using namespace std;

#define sf scanf
#define pf printf
#define pfn printf("\n");
#define ll long long
#define sfd(n) scanf("%d",&n);
#define sfld(n) scanf("%lld",&n);
#define sflf(n) scanf("%lf",&n);
#define sfc(n) scanf("%c",&n);
#define sfs(n) scanf("%s",&n);
#define pfd(n) printf("%d",n);
#define pfld(n) printf("%lld",n);
#define pflf(n) printf("%lf",n);
#define pfc(n) printf("%c",n);
#define pfs(n) printf("%s",n);

#define csh(a,n) memset(a,n,sizeof(a));
ll arr[300002];
map<ll,int>brr;
ll crr[300001];
ll GCD(ll a,ll b)
{
	return b==0?a:GCD(b,a%b);
}
int *sushubiao()
{
	int i,j;
	int MAX=0x3f3f3f;				//0x3f3f3f=1061109567
	int *shu= new int [MAX];
	int *sushu= new int [292676];	//一共有292676个素数
	for(i=0;i<MAX;i++)
		shu[i]=1;
	int count=0;
	for(i=2;i<MAX;i++)
	{
		if(shu[i]==1)
		{
			for(j=2;j*i<MAX;j++)
			{
				shu[i*j]=0;
			}
			sushu[count++]=i;

		}
	}
	delete[] shu;				//释放数组shu的内存
	return sushu;
}
int main()
{
	int n,m;
	ll f;
	sfd(n)
	sfd(m)
	for(int i=0;i<n;i++)
	{
		cin>>arr[i];
	}
	for(int i=0;i<n-1;i++)
	{
		crr[i]=arr[i+1]-arr[i];
	}
	ll sum=crr[0];
	for(int i=1;i<n-1;i++)
	{
		sum=GCD(sum,crr[i]);
	}
	for(int i=1;i<=m;i++)
	{
		cin>>f;
		brr[f]=i;
	}
	int *p=sushubiao();
	int i=0;
	if(brr[sum]>0)
	{
		cout<<"YES"<<endl<<arr[0]<<" "<<brr[sum]<<endl;
		return 0;
	}
	else{
		while(1)
		{
			if(sum%p[i]==0)
			{
				sum/=p[i];
				if(brr[sum])
				{
					cout<<"YES"<<endl<<arr[0]<<" "<<brr[sum]<<endl;
					return 0;
				}
			}
			if(sum<p[i])
			{
				break;
			}
			i++;
		}
	}
	cout<<"NO"<<endl;
	return 0;
}


#include<iostream>
#include<string>
#include<algorithm>
#include<map>
#include<set>
#include<vector>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<queue>
#include<utility>
#include<sstream>
using namespace std;

#define sf scanf
#define pf printf
#define pfn printf("\n");
#define ll long long
#define sfd(n) scanf("%d",&n);
#define sfld(n) scanf("%lld",&n);
#define sflf(n) scanf("%lf",&n);
#define sfc(n) scanf("%c",&n);
#define sfs(n) scanf("%s",&n);
#define pfd(n) printf("%d",n);
#define pfld(n) printf("%lld",n);
#define pflf(n) printf("%lf",n);
#define pfc(n) printf("%c",n);
#define pfs(n) printf("%s",n);

#define csh(a,n) memset(a,n,sizeof(a));
ll arr[300002];
map<ll,int>brr;
ll crr[300001];
ll GCD(ll a,ll b)
{
	return b==0?a:GCD(b,a%b);
}
int *sushubiao()
{
	int i,j;
	int MAX=0x3f3f3f;				//0x3f3f3f=1061109567
	int *shu= new int [MAX];
	int *sushu= new int [292676];	//一共有292676个素数
	for(i=0;i<MAX;i++)
		shu[i]=1;
	int count=0;
	for(i=2;i<MAX;i++)
	{
		if(shu[i]==1)
		{
			for(j=2;j*i<MAX;j++)
			{
				shu[i*j]=0;
			}
			sushu[count++]=i;

		}
	}
	delete[] shu;				//释放数组shu的内存
	return sushu;
}
int main()
{
	int n,m;
	ll f;
	sfd(n)
	sfd(m)
	for(int i=0;i<n;i++)
	{
		cin>>arr[i];
	}
	for(int i=0;i<n-1;i++)
	{
		crr[i]=arr[i+1]-arr[i];
	}
	ll sum=crr[0];
	for(int i=1;i<n-1;i++)
	{
		sum=GCD(sum,crr[i]);
	}
	for(int i=1;i<=m;i++)
	{
		cin>>f;
		brr[f]=i;
	}
	int *p=sushubiao();
	int i=0;
	if(brr[sum]>0)
	{
		cout<<"YES"<<endl<<arr[0]<<" "<<brr[sum]<<endl;
		return 0;
	}
	else{
		sum/=p[i];
		if(brr[sum])
		{
			cout<<"YES"<<endl<<arr[0]<<" "<<brr[sum]<<endl;
			return 0;
		}
	}
	cout<<"NO"<<endl;
	return 0;
}


#include<iostream>
#include<string>
#include<algorithm>
#include<map>
#include<set>
#include<vector>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<queue>
#include<utility>
#include<sstream>
using namespace std;

#define sf scanf
#define pf printf
#define pfn printf("\n");
#define ll long long
#define sfd(n) scanf("%d",&n);
#define sfld(n) scanf("%lld",&n);
#define sflf(n) scanf("%lf",&n);
#define sfc(n) scanf("%c",&n);
#define sfs(n) scanf("%s",&n);
#define pfd(n) printf("%d",n);
#define pfld(n) printf("%lld",n);
#define pflf(n) printf("%lf",n);
#define pfc(n) printf("%c",n);
#define pfs(n) printf("%s",n);

#define csh(a,n) memset(a,n,sizeof(a));
ll arr[300002];
map<ll,ll>brr;
ll crr[300001];
ll GCD(ll a,ll b)
{
	return b==0?a:GCD(b,a%b);
}
ll *sushubiao()
{
	ll i,j;
	ll MAX=0x3f3f3f;				//0x3f3f3f=1061109567
	ll *shu= new ll [MAX];
	ll *sushu= new ll [292676];	//一共有292676个素数
	for(i=0;i<MAX;i++)
		shu[i]=1;
	ll count=0;
	for(i=2;i<MAX;i++)
	{
		if(shu[i]==1)
		{
			for(j=2;j*i<MAX;j++)
			{
				shu[i*j]=0;
			}
			sushu[count++]=i;

		}
	}
	delete[] shu;				//释放数组shu的内存
	return sushu;
}
int main()
{
	ll n,m;
	ll f;
	sfd(n)
	sfd(m)
	for(ll i=0;i<n;i++)
	{
		cin>>arr[i];
	}
	for(ll i=0;i<n-1;i++)
	{
		crr[i]=arr[i+1]-arr[i];
	}
	ll sum=crr[0];
	for(ll i=1;i<n-1;i++)
	{
		sum=GCD(sum,crr[i]);
	}
	for(ll i=1;i<=m;i++)
	{
		cin>>f;
		brr[f]=i;
	}
	ll *p=sushubiao();
	ll i=0;
	if(brr[sum]>0)
	{
		cout<<"YES"<<endl<<arr[0]<<" "<<brr[sum]<<endl;
		return 0;
	}
	else{
		sum/=p[i];
		if(brr[sum])
		{
			cout<<"YES"<<endl<<arr[0]<<" "<<brr[sum]<<endl;
			return 0;
		}
	}
	cout<<"NO"<<endl;
	return 0;
}


#include<algorithm>
#include<iterator>
#include<iostream>
#include<cstring>
#include<cstdlib>
#include<iomanip>
#include<bitset>
#include<cctype>
#include<cstdio>
#include<string>
#include<vector>
#include<stack>
#include<cmath>
#include<queue>
#include<list>
#include<map>
#include<set>
#include<cassert>
#define ll long long
using namespace std;
inline int read() {
	char c;
	int ret = 0, sgn = 1;
	do { c = getchar(); } while ((c < '0' || c > '9') && c != '-');
	if (c == '-') sgn = -1; else ret = c - '0';
	while ((c = getchar()) >= '0' && c <= '9') ret = ret * 10 + (c - '0');
	return sgn * ret;
}
inline ll readl() {
	char c;
	ll ret = 0, sgn = 1;
	do { c = getchar(); } while ((c < '0' || c > '9') && c != '-');
	if (c == '-') sgn = -1; else ret = c - '0';
	while ((c = getchar()) >= '0' && c <= '9') ret = ret * 10 + (c - '0');
	return sgn * ret;
}
ll mod_pow(ll a,ll b,ll mod){
   ll ans=1;
   while(b){
   if(b&1) ans=(ans*a)%mod;
   		   a=(a*a)%mod;
		   b>>=1;
	} return ans;
}
const int INF = 0x3f3f3f3f;
int T,n,m,tot,cnt;	char c; ll ans,sum; bool flag=0;
struct P{
};
void rd(){
	#ifdef Dmymax_ly
		   freopen("test.in","r",stdin);
	#endif
}
ll a[300005],b[300005];
int main(){
	rd();
    scanf("%d %d",&n,&m);
    for(int i=1;i<=n;i++){
    	scanf("%I64d",&a[i]);
    }
    ll lcm=a[2]-a[1];
    for(int i=2;i<=n;i++){
    	lcm=__gcd(lcm,a[i]-a[i-1]);
    }
    for(int i=1;i<=m;i++)	scanf("%I64d",&b[i]);
	for(k=1;k<=m;k++){
		if((lcm % b[k])==0LL){
			puts("YES");
			printf("%I64d %d\n", a[1] , k );
			return 0;
		}
	}
	puts("NO");
	return 0;
}


#include<algorithm>
#include<iterator>
#include<iostream>
#include<cstring>
#include<cstdlib>
#include<iomanip>
#include<bitset>
#include<cctype>
#include<cstdio>
#include<string>
#include<vector>
#include<stack>
#include<cmath>
#include<queue>
#include<list>
#include<map>
#include<set>
#include<cassert>
#define ll long long
using namespace std;
inline int read() {
	char c;
	int ret = 0, sgn = 1;
	do { c = getchar(); } while ((c < '0' || c > '9') && c != '-');
	if (c == '-') sgn = -1; else ret = c - '0';
	while ((c = getchar()) >= '0' && c <= '9') ret = ret * 10 + (c - '0');
	return sgn * ret;
}
inline ll readl() {
	char c;
	ll ret = 0, sgn = 1;
	do { c = getchar(); } while ((c < '0' || c > '9') && c != '-');
	if (c == '-') sgn = -1; else ret = c - '0';
	while ((c = getchar()) >= '0' && c <= '9') ret = ret * 10 + (c - '0');
	return sgn * ret;
}
ll mod_pow(ll a,ll b,ll mod){
   ll ans=1;
   while(b){
   if(b&1) ans=(ans*a)%mod;
   		   a=(a*a)%mod;
		   b>>=1;
	} return ans;
}
const int INF = 0x3f3f3f3f;
int T,n,m,tot,cnt;	char c; ll ans,sum; bool flag=0;
struct P{
};
void rd(){
	#ifdef Dmymax_ly
		   freopen("test.in","r",stdin);
	#endif
}
ll a[300005],b[300005];
int main(){
	rd();
    scanf("%d %d",&n,&m);
    for(int i=1;i<=n;i++){
    	scanf("I64d",&a[i]);
    }
    ll lcm=a[2]-a[1];
    for(int i=2;i<=n;i++){
    	lcm=__gcd(lcm,a[i]-a[i-1]);
    }
    for(int i=1;i<=m;i++)	scanf("I64d",&b[i]);
	for(int k=1;k<=m;k++){
		if((lcm % b[k])==0LL){
			puts("YES");
			printf("I64d %d\n", a[1] , k );
			return 0;
		}
	}
	puts("NO");
	return 0;
}


#include<algorithm>
#include<iterator>
#include<iostream>
#include<cstring>
#include<cstdlib>
#include<iomanip>
#include<bitset>
#include<cctype>
#include<cstdio>
#include<string>
#include<vector>
#include<stack>
#include<cmath>
#include<queue>
#include<list>
#include<map>
#include<set>
#include<cassert>
#define ll long long
using namespace std;
inline int read() {
	char c;
	int ret = 0, sgn = 1;
	do { c = getchar(); } while ((c < '0' || c > '9') && c != '-');
	if (c == '-') sgn = -1; else ret = c - '0';
	while ((c = getchar()) >= '0' && c <= '9') ret = ret * 10 + (c - '0');
	return sgn * ret;
}
inline ll readl() {
	char c;
	ll ret = 0, sgn = 1;
	do { c = getchar(); } while ((c < '0' || c > '9') && c != '-');
	if (c == '-') sgn = -1; else ret = c - '0';
	while ((c = getchar()) >= '0' && c <= '9') ret = ret * 10 + (c - '0');
	return sgn * ret;
}
ll mod_pow(ll a,ll b,ll mod){
   ll ans=1;
   while(b){
   if(b&1) ans=(ans*a)%mod;
   		   a=(a*a)%mod;
		   b>>=1;
	} return ans;
}
const int INF = 0x3f3f3f3f;
int T,n,m,tot,cnt;	char c; ll ans,sum; bool flag=0;
struct P{
};
void rd(){
	#ifdef Dmymax_ly
		   freopen("test.in","r",stdin);
	#endif
}
int a[300005],b[300005];
int main(){
	rd();
    scanf("%d %d",&n,&m);
    for(int i=1;i<=n;i++){
    	scanf("%d",&a[i]);
    }
    int lcm=a[2]-a[1];
    for(int i=2;i<=n;i++){
    	lcm=__gcd(lcm,a[i]-a[i-1]);
    }
    for(int i=1;i<=m;i++)	scanf("%d",&b[i]);
	for(int k=1;k<=m;k++){
		if(lcm%b[k]==0){
			puts("YES");
			printf("%d %d\n", a[1] , k );
			return 0;
		}
	}
	puts("NO");
	return 0;
}


#include<algorithm>
#include<iterator>
#include<iostream>
#include<cstring>
#include<cstdlib>
#include<iomanip>
#include<bitset>
#include<cctype>
#include<cstdio>
#include<string>
#include<vector>
#include<stack>
#include<cmath>
#include<queue>
#include<list>
#include<map>
#include<set>
#include<cassert>
#define ll long long
using namespace std;
inline int read() {
	char c;
	int ret = 0, sgn = 1;
	do { c = getchar(); } while ((c < '0' || c > '9') && c != '-');
	if (c == '-') sgn = -1; else ret = c - '0';
	while ((c = getchar()) >= '0' && c <= '9') ret = ret * 10 + (c - '0');
	return sgn * ret;
}
inline ll readl() {
	char c;
	ll ret = 0, sgn = 1;
	do { c = getchar(); } while ((c < '0' || c > '9') && c != '-');
	if (c == '-') sgn = -1; else ret = c - '0';
	while ((c = getchar()) >= '0' && c <= '9') ret = ret * 10 + (c - '0');
	return sgn * ret;
}
ll mod_pow(ll a,ll b,ll mod){
   ll ans=1;
   while(b){
   if(b&1) ans=(ans*a)%mod;
   		   a=(a*a)%mod;
		   b>>=1;
	} return ans;
}
const int INF = 0x3f3f3f3f;
int T,n,m,tot,cnt;	char c; ll ans,sum; bool flag=0;
struct P{
};
void rd(){
	#ifdef Dmymax_ly
		   freopen("test.in","r",stdin);
	#endif
}
ll a[300005],b[300005];
int main(){
	rd();
    scanf("%d %d",&n,&m);
    for(int i=1;i<=n;i++){
    	cin>>a[i];
    }
    ll lcm=a[2]-a[1];
    for(int i=2;i<=n;i++){
    	lcm=__gcd(lcm,a[i]-a[i-1]);
    }
    for(int i=1;i<=m;i++)	cin>>b[i];
	for(k=1;k<=m;k++){
		if((lcm % b[k])==0LL){
			puts("YES");
			printf("%d %d\n", a[1] , k );
			return 0;
		}
	}
	puts("NO");
	return 0;
}


#include<algorithm>
#include<iterator>
#include<iostream>
#include<cstring>
#include<cstdlib>
#include<iomanip>
#include<bitset>
#include<cctype>
#include<cstdio>
#include<string>
#include<vector>
#include<stack>
#include<cmath>
#include<queue>
#include<list>
#include<map>
#include<set>
#include<cassert>
#define ll long long
using namespace std;
inline int read() {
	char c;
	int ret = 0, sgn = 1;
	do { c = getchar(); } while ((c < '0' || c > '9') && c != '-');
	if (c == '-') sgn = -1; else ret = c - '0';
	while ((c = getchar()) >= '0' && c <= '9') ret = ret * 10 + (c - '0');
	return sgn * ret;
}
inline ll readl() {
	char c;
	ll ret = 0, sgn = 1;
	do { c = getchar(); } while ((c < '0' || c > '9') && c != '-');
	if (c == '-') sgn = -1; else ret = c - '0';
	while ((c = getchar()) >= '0' && c <= '9') ret = ret * 10 + (c - '0');
	return sgn * ret;
}
ll mod_pow(ll a,ll b,ll mod){
   ll ans=1;
   while(b){
   if(b&1) ans=(ans*a)%mod;
   		   a=(a*a)%mod;
		   b>>=1;
	} return ans;
}
const int INF = 0x3f3f3f3f;
int T,n,m,tot,cnt;	char c; ll ans,sum; bool flag=0;
struct P{
};
void rd(){
	#ifdef Dmymax_ly
		   freopen("test.in","r",stdin);
	#endif
}
ll a[300005],b[300005];
int main(){
	rd();
    scanf("%d %d",&n,&m);
    for(int i=1;i<=n;i++){
    	cin>>a[i];
    }
    ll lcm=a[2]-a[1];
    for(int i=2;i<=n;i++){
    	lcm=__gcd(lcm,a[i]-a[i-1]);
    }
    for(int i=1;i<=m;i++)	cin>>b[i];
	for(int k=1;k<=m;k++){
		if((lcm % b[k])==0LL){
			puts("YES");
			printf("%d %d\n", a[1] , k );
			return 0;
		}
	}
	puts("NO");
	return 0;
}


#include<algorithm>
#include<iterator>
#include<iostream>
#include<cstring>
#include<cstdlib>
#include<iomanip>
#include<bitset>
#include<cctype>
#include<cstdio>
#include<string>
#include<vector>
#include<stack>
#include<cmath>
#include<queue>
#include<list>
#include<map>
#include<set>
#include<cassert>
#define ll long long
using namespace std;
inline int read() {
	char c;
	int ret = 0, sgn = 1;
	do { c = getchar(); } while ((c < '0' || c > '9') && c != '-');
	if (c == '-') sgn = -1; else ret = c - '0';
	while ((c = getchar()) >= '0' && c <= '9') ret = ret * 10 + (c - '0');
	return sgn * ret;
}
inline ll readl() {
	char c;
	ll ret = 0, sgn = 1;
	do { c = getchar(); } while ((c < '0' || c > '9') && c != '-');
	if (c == '-') sgn = -1; else ret = c - '0';
	while ((c = getchar()) >= '0' && c <= '9') ret = ret * 10 + (c - '0');
	return sgn * ret;
}
ll mod_pow(ll a,ll b,ll mod){
   ll ans=1;
   while(b){
   if(b&1) ans=(ans*a)%mod;
   		   a=(a*a)%mod;
		   b>>=1;
	} return ans;
}
const int INF = 0x3f3f3f3f;
int T,n,m,tot,cnt;	char c; ll ans,sum; bool flag=0;
struct P{
};
void rd(){
	#ifdef Dmymax_ly
		   freopen("test.in","r",stdin);
	#endif
}
ll a[300005],b[300005];
int main(){
	rd();
    scanf("%d %d",&n,&m);
    for(int i=1;i<=n;i++){
    	cin>>a[i];
    }
    ll lcm=a[2]-a[1];
    for(int i=2;i<=n;i++){
    	lcm=(ll)(__gcd(lcm,a[i]-a[i-1]));
    }
    for(int i=1;i<=m;i++)	cin>>b[i];
	for(int k=1;k<=m;k++){
		if((lcm % b[k])==0LL){
			puts("YES");
			cout<<a[1]<<" "<<k<<endl;
			return 0;
		}
	}
	puts("NO");
	return 0;
}


#include<algorithm>
#include<iterator>
#include<iostream>
#include<cstring>
#include<cstdlib>
#include<iomanip>
#include<bitset>
#include<cctype>
#include<cstdio>
#include<string>
#include<vector>
#include<stack>
#include<cmath>
#include<queue>
#include<list>
#include<map>
#include<set>
#include<cassert>
#define ll long long
using namespace std;
inline int read() {
	char c;
	int ret = 0, sgn = 1;
	do { c = getchar(); } while ((c < '0' || c > '9') && c != '-');
	if (c == '-') sgn = -1; else ret = c - '0';
	while ((c = getchar()) >= '0' && c <= '9') ret = ret * 10 + (c - '0');
	return sgn * ret;
}
inline ll readl() {
	char c;
	ll ret = 0, sgn = 1;
	do { c = getchar(); } while ((c < '0' || c > '9') && c != '-');
	if (c == '-') sgn = -1; else ret = c - '0';
	while ((c = getchar()) >= '0' && c <= '9') ret = ret * 10 + (c - '0');
	return sgn * ret;
}
ll mod_pow(ll a,ll b,ll mod){
   ll ans=1;
   while(b){
   if(b&1) ans=(ans*a)%mod;
   		   a=(a*a)%mod;
		   b>>=1;
	} return ans;
}
const int INF = 0x3f3f3f3f;
int T,n,m,tot,cnt;	char c; ll ans,sum; bool flag=0;
struct P{
};
void rd(){
	#ifdef Dmymax_ly
		   freopen("test.in","r",stdin);
	#endif
}
int a[300005],b[300005];
int main(){
	rd();
    scanf("%d %d",&n,&m);
    for(int i=1;i<=n;i++){
    	scanf("%d",&a[i]);
    }
    int lcm=a[2]-a[1];
    for(int i=2;i<=n;i++){
    	lcm=__gcd(lcm,a[i]-a[i-1]);
    }
    for(int i=1;i<=m;i++)	scanf("%d",&b[i]);
    int k;
	for(k=1;k<=m;k++){
		if(lcm%b[k]==0){
			puts("YES");
			printf("%d %d\n", a[1] , k );
			return 0;
		}
	}
	puts("NO");
	return 0;
}


#include<algorithm>
#include<iterator>
#include<iostream>
#include<cstring>
#include<cstdlib>
#include<iomanip>
#include<bitset>
#include<cctype>
#include<cstdio>
#include<string>
#include<vector>
#include<stack>
#include<cmath>
#include<queue>
#include<list>
#include<map>
#include<set>
#include<cassert>
#define ll long long
using namespace std;
inline int read() {
	char c;
	int ret = 0, sgn = 1;
	do { c = getchar(); } while ((c < '0' || c > '9') && c != '-');
	if (c == '-') sgn = -1; else ret = c - '0';
	while ((c = getchar()) >= '0' && c <= '9') ret = ret * 10 + (c - '0');
	return sgn * ret;
}
inline ll readl() {
	char c;
	ll ret = 0, sgn = 1;
	do { c = getchar(); } while ((c < '0' || c > '9') && c != '-');
	if (c == '-') sgn = -1; else ret = c - '0';
	while ((c = getchar()) >= '0' && c <= '9') ret = ret * 10 + (c - '0');
	return sgn * ret;
}
ll mod_pow(ll a,ll b,ll mod){
   ll ans=1;
   while(b){
   if(b&1) ans=(ans*a)%mod;
   		   a=(a*a)%mod;
		   b>>=1;
	} return ans;
}
const int INF = 0x3f3f3f3f;
int T,n,m,tot,cnt;	char c; ll ans,sum; bool flag=0;
struct P{
};
void rd(){
	#ifdef Dmymax_ly
		   freopen("test.in","r",stdin);
	#endif
}
ll a[300005],b[300005];
int main(){
	rd();
    scanf("%d %d",&n,&m);
    for(int i=1;i<=n;i++){
    	scanf("%lld",&a[i]);
    }
    int lcm=a[2]-a[1];
    for(int i=2;i<=n;i++){
    	lcm=__gcd(lcm,a[i]-a[i-1]);
    }
    for(int i=1;i<=m;i++)	scanf("%lld",&b[i]);
	for(k=1;k<=m;k++){
		if((lcm % b[k])==0LL){
			puts("YES");
			printf("%d %d\n", a[1] , k );
			return 0;
		}
	}
	puts("NO");
	return 0;
}


#include <iostream>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <string>
#include <map>
#include <iomanip>
#include <algorithm>
#include <queue>
#include <stack>
#include <set>
#include <vector>
//const int maxn = 1e5+5;
#define ll long long
#define MAX INT_MAX
#define FOR(i,a,b) for( int i = a;i <= b;++i)
using namespace std;
ll n,m,sum;
ll a[310000];
struct node
{
    ll nub,t;
}b[310000];
bool cmp(node x,node y)
{
    return x.t<y.t;
}
int main()
{
//    freopen("D:\\common_text\\code_stream\\in.txt","r",stdin);
//    freopen("D:\\common_text\\code_stream\\out.txt","w",stdout);
    cin>>n>>m;
    for(ll i=1;i<=n;++i)
    {
        cin>>a[i];
    }

    for(ll i=1;i<=m;++i)
    {
        cin>>b[i].t;
        b[i].nub=i;
    }
    sort(b+1,b+1+m,cmp);

    ll temp=a[n]-a[1];

    for(int i=1;i<=m;++i)
    {
        if(b[i].t>temp)
        {
            continue;
        }
        for(int j=2;j<=n;++j)
        {
            if((a[j]-a[1])%b[i].t==0&&j==n)
            {
                cout<<"YES"<<endl;
                cout<<a[1]<<" "<<b[i].nub<<endl;
                //cout<<a[i]<<" "<<a[1];
                return 0;
            }
            else if((a[j]-a[1])%b[i].t!=0)
                break;
        }
    }
    cout<<"NO";
}


#include <iostream>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <string>
#include <map>
#include <iomanip>
#include <algorithm>
#include <queue>
#include <stack>
#include <set>
#include <vector>
//const int maxn = 1e5+5;
#define ll long long
#define MAX INT_MAX
#define FOR(i,a,b) for( int i = a;i <= b;++i)
using namespace std;
ll n,m,sum;
ll a[310000],b[310000];
int main()
{
//    freopen("D:\\common_text\\code_stream\\in.txt","r",stdin);
//    freopen("D:\\common_text\\code_stream\\out.txt","w",stdout);
    cin>>n>>m;
    for(int i=1;i<=n;++i)
    {
        cin>>a[i];
    }

    FOR(i,1,m)
    {
        cin>>b[i];
    }
    //sort(a+1,a+1+n);

    sum=a[n]-a[1];
    int temp=sum/(n-1);

    for(int i=1;i<=m;++i)
    {
        if(b[i]>temp)
        {
            continue;
        }
        for(int j=2;j<=n;++j)
        {
            if((a[j]-a[1])%b[i]==0&&j==n)
            {
                cout<<"YES"<<endl;
                cout<<a[1]<<" "<<i<<endl;
                //cout<<a[i]<<" "<<a[1];
                return 0;
            }
            else if((a[j]-a[1])%b[i]!=0)
                break;
        }
    }
    cout<<"NO";
}


#include <iostream>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <string>
#include <map>
#include <iomanip>
#include <algorithm>
#include <queue>
#include <stack>
#include <set>
#include <vector>
//const int maxn = 1e5+5;
#define ll long long
#define MAX INT_MAX
#define FOR(i,a,b) for( int i = a;i <= b;++i)
using namespace std;
ll n,m,sum;
ll a[310000],b[310000];
int main()
{
//    freopen("D:\\common_text\\code_stream\\in.txt","r",stdin);
//    freopen("D:\\common_text\\code_stream\\out.txt","w",stdout);
    cin>>n>>m;
    for(int i=1;i<=n;++i)
    {
        cin>>a[i];
    }

    FOR(i,1,m)
    {
        cin>>b[i];
    }
    //sort(a+1,a+1+n);

//    sum=a[n]-a[1];
//    ll temp=sum/(n-1);

    for(int i=1;i<=m;++i)
    {
//        if(b[i]>temp)
//        {
//            continue;
//        }
        for(int j=2;j<=n;++j)
        {
            if((a[j]-a[1])%b[i]==0&&j==n)
            {
                cout<<"YES"<<endl;
                cout<<a[1]<<" "<<i<<endl;
                //cout<<a[i]<<" "<<a[1];
                return 0;
            }
            else if((a[j]-a[1])%b[i]!=0)
                break;
        }
    }
    cout<<"NO";
}


#include <iostream>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <string>
#include <map>
#include <iomanip>
#include <algorithm>
#include <queue>
#include <stack>
#include <set>
#include <vector>
//const int maxn = 1e5+5;
#define ll long long
#define MAX INT_MAX
#define FOR(i,a,b) for( int i = a;i <= b;++i)
using namespace std;
ll n,m,sum;
ll a[310000],b[310000];
int main()
{
//    freopen("D:\\common_text\\code_stream\\in.txt","r",stdin);
//    freopen("D:\\common_text\\code_stream\\out.txt","w",stdout);
    cin>>n>>m;
    for(ll i=1;i<=n;++i)
    {
        cin>>a[i];
    }

    for(ll i=1;i<=m;++i)
    {
        cin>>b[i];
    }
    //sort(a+1,a+1+n);

    ll temp=a[n]-a[1];

    for(int i=1;i<=m;++i)
    {
        if(b[i]>temp)
        {
            continue;
        }
        for(int j=2;j<=n;++j)
        {
            if((a[j]-a[1])%b[i]==0&&j==n)
            {
                cout<<"YES"<<endl;
                cout<<a[1]<<" "<<i<<endl;
                //cout<<a[i]<<" "<<a[1];
                return 0;
            }
            else if((a[j]-a[1])%b[i]!=0)
                break;
        }
    }
    cout<<"NO";
}


#include <iostream>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <string>
#include <map>
#include <iomanip>
#include <algorithm>
#include <queue>
#include <stack>
#include <set>
#include <vector>
//const int maxn = 1e5+5;
#define ll long long
#define MAX INT_MAX
#define FOR(i,a,b) for( ll i = a;i <= b;++i)
using namespace std;
ll n,m;
ll a[310000],b[310000],c[310000];
ll gcd(ll a,ll b)
{
     return !b?a:gcd(b,a%b);//本代码的核心，gcd约分代码
}
int main()
{
    //    freopen("D:\\common_text\\code_stream\\in.txt","r",stdin);
    //    freopen("D:\\common_text\\code_stream\\out.txt","w",stdout);
    cin>>n>>m;
    FOR(i,1,n)
    {
        cin>>a[i];
    }
    FOR(i,1,m)
    {
        cin>>b[i];
    }
    FOR(i ,1, n-1)
    {
        c[i]=a[i+1]-a[i];
    }
    ll temp=c[1];
    for(ll i=2;i<n;++i)
    {
        temp=gcd(c[i],temp);
    }
    for(ll i=1;i<=m;++i)
    {
        if(temp%b[i]==0)
        {
            cout<<"YES"<<endl<<a[1]<<" "<<i;
            return 0;
        }
    }
    cout<<"NO";

}


#include <iostream>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <string>
#include <map>
#include <iomanip>
#include <algorithm>
#include <queue>
#include <stack>
#include <set>
#include <vector>
//const int maxn = 1e5+5;
#define ll long long
#define MAX INT_MAX
#define FOR(i,a,b) for( ll i = a;i <= b;++i)
using namespace std;
ll n,m;
ll a[310000],b[310000],c[310000];
int gcd(int a,int b)
{
     return !b?a:gcd(b,a%b);//本代码的核心，gcd约分代码
}
int main()
{
    //    freopen("D:\\common_text\\code_stream\\in.txt","r",stdin);
    //    freopen("D:\\common_text\\code_stream\\out.txt","w",stdout);
    cin>>n>>m;
    FOR(i,1,n)
    {
        cin>>a[i];
    }
    FOR(i,1,m)
    {
        cin>>b[i];
    }
    FOR(i ,1, n-1)
    {
        c[i]=a[i+1]-a[i];
    }
    ll temp=c[1];
    for(ll i=2;i<n;++i)
    {
        temp=gcd(c[i],temp);
    }
    for(ll i=1;i<=m;++i)
    {
        if(temp%b[i]==0)
        {
            cout<<"YES"<<endl<<a[i]<<" "<<i;
            return 0;
        }
    }
    cout<<"NO";

}


#include <iostream>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <string>
#include <map>
#include <iomanip>
#include <algorithm>
#include <queue>
#include <stack>
#include <set>
#include <vector>
//const int maxn = 1e5+5;
#define ll long long
#define MAX INT_MAX
#define FOR(i,a,b) for( ll i = a;i <= b;++i)
using namespace std;
ll n,m;
ll a[310000],b[310000],c[310000];
int gcd(int a,int b)
{
     return !b?a:gcd(b,a%b);//本代码的核心，gcd约分代码
}
int main()
{
    //    freopen("D:\\common_text\\code_stream\\in.txt","r",stdin);
    //    freopen("D:\\common_text\\code_stream\\out.txt","w",stdout);
    cin>>n>>m;
    FOR(i,1,n)
    {
        cin>>a[i];
    }
    FOR(i,1,m)
    {
        cin>>b[i];
    }
    FOR(i ,1, n-1)
    {
        c[i]=a[i+1]-a[i];
    }
    ll temp=c[1];
    for(ll i=2;i<n;++i)
    {
        temp=gcd(c[i],temp);
    }
    for(ll i=1;i<=m;++i)
    {
        if(temp%b[i]==0)
        {
            cout<<"YES"<<endl<<a[1]<<" "<<i;
            return 0;
        }
    }
    cout<<"NO";

}


#include <iostream>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <string>
#include <map>
#include <iomanip>
#include <algorithm>
#include <queue>
#include <stack>
#include <set>
#include <vector>
//const int maxn = 1e5+5;
#define ll long long
#define MAX INT_MAX
#define FOR(i,a,b) for( ll i = a;i <= b;++i)
using namespace std;
ll n,m;
ll a[310000],b[310000],c[310000];
int gcd(int a,int b)
{
     return !b?a:gcd(b,a%b);//本代码的核心，gcd约分代码
}
int main()
{
    //    freopen("D:\\common_text\\code_stream\\in.txt","r",stdin);
    //    freopen("D:\\common_text\\code_stream\\out.txt","w",stdout);
    cin>>n>>m;
    FOR(i,1,n)
    {
        cin>>a[i];
    }
    FOR(i,1,m)
    {
        cin>>b[i];
    }
    FOR(i ,1, n-1)
    {
        c[i]=a[i+1]-a[i];
    }
    ll temp=c[1];
    for(ll i=2;i<n;++i)
    {
        temp=gcd(c[i],temp);
    }
    for(ll i=1;i<=m;++i)
    {
        if(temp%b[i]==0)
        {
            cout<<"YES"<<endl<<b[i]<<" "<<i;
            return 0;
        }
    }
    cout<<"NO";

}


#include <iostream>
#include <cmath>
#include <bits/stdc++.h>

using namespace std;

long long my_gcd(long long a, long long b)
{
    if (a == 0)
        return b;
    return  my_gcd(b % a, a);
}
int main()
{
    int n, m;
    cin >> n >> m;

    vector<long long> x(n);
    for (int i= 0; i< n; i++) cin >> x[i];

    vector<long long> y(m);
    for (int i= 0; i< m; i++) cin >> y[i];

    long long gcd = 0;

    gcd = my_gcd(x[0], x[1]);

    for (int i= 2; i < n; i++) gcd == my_gcd(gcd, x[i]);

    bool solved = false;
    long long a = -1, b= -1;

    for (int i = 0; i< m ; i++) {
        if (gcd%y[i] == 0) {
            solved = true;
            a = x[0];
            b = i;
            break;
        }
    }

    if (solved) {
        cout << "YES" << endl << a << " " << b + 1 << endl;
    } else {
        cout << "NO" << endl;
    }

    return 0;
}


#include <iostream>
#include <cmath>
#include <bits/stdc++.h>

using namespace std;

int main()
{
    int n, m;
    cin >> n >> m;

    vector<long long> x(n);
    for (int i= 0; i< n; i++) cin >> x[i];

    vector<long long> y(m);
    for (int i= 0; i< m; i++) cin >> y[i];

    long long gcd = 0;

    gcd = __gcd(x[0], x[1]);

    for (int i= 2; i < n; i++) gcd == __gcd(gcd, x[i]);

    bool solved = false;
    long long a = -1, b= -1;

    for (int i = 0; i< m ; i++) {
        if (gcd%y[i] == 0) {
            solved = true;
            a = x[0];
            b = i;
            break;
        }
    }

    if (solved) {
        cout << "YES" << endl << a << " " << b + 1 << endl;
    } else {
        cout << "NO" << endl;
    }

    return 0;
}


#include <iostream>
#include <cmath>
#include <bits/stdc++.h>

using namespace std;

int main()
{
    int n, m;
    cin >> n >> m;

    vector<int> x(n);
    for (int i= 0; i< n; i++) cin >> x[i];

    vector<int> y(m);
    for (int i= 0; i< m; i++) cin >> y[i];

    int gcd = 0;

    gcd = __gcd(x[0], x[1]);

    for (int i= 2; i < n; i++) gcd == __gcd(gcd, x[i]);

    bool solved = false;
    int a = -1, b= -1;

    for (int i = 0; i< m ; i++) {
        if (gcd%y[i] == 0) {
            solved = true;
            a = x[0];
            b = i;
            break;
        }
    }

    if (solved) {
        cout << "YES" << endl << a << " " << b << endl;
    } else {
        cout << "NO" << endl;
    }

    return 0;
}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
const int N=5e5+5;
int a[N];

int main(){
	int n;
	scanf("%d",&n);
	if(n&1){
		for(int i=1,t=1;i<=n/2;i++,t+=2){
			a[i]=t;
			a[n-i+1]=t;
		}
		a[(n/2)+1]=n;
		for(int i=n+1,t=2;i<=n+n/2;i++,t+=2){
			a[i]=t;
			a[3*n-i]=t;
		}
		a[2*n]=n;
	}else {
		for(int i=1,t=1;i<=n/2;i++,t+=2){
			a[i]=t;
			a[n-i+1]=t;
		}
		for(int i=n+1,t=2;i<=(n-1)/2+n;i++,t+=2){
			a[i]=t;
			a[3*n-i]=t;
		}
		a[2*n]=n;
		a[n+n/2]=n;
	}
	for(int i=1;i<=2*n;i++){
		printf("%d ",a[i]);
	}
	return 0;
}


#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <cmath>
int i,j,n,m,k,l,o,p;
int main()
{
	scanf("%d",&n);
	for (i=1;i<=n;i++)
	 if (i%2==1) printf("%d ",i);
	for (i=n;i>=1;i--)
	 if (i%2==1) printf("%d ",i);
	for (i=1;i<=n;i++)
	 if (i%2==0) printf("%d ",i);
	for (i=n;i>=1;i--)
	 if (i%2==0) printf("%d ",i);
}


#include<stdio.h>
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<queue>
#include<cstring>
using namespace std;
const int maxn=1000100;
int n,a[maxn];
int main()
{
	scanf("%d",&n);
	for(int i=1;i<=n;++i)
	{
		int x,y;
		if(i&1)x=i/2+1;
		else x=n+i/2;
		y=x+n-i;
		a[x]=a[y]=i;
	}
	for(int i=1;i<=2*n;++i)
	{
		printf("%d ",a[i]==0?n:a[i]);
	}
	return 0;
}


#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <cmath>
int i,j,n,m,k,l,o,p;
int main()
{
	scanf("%d",&n);
	for (i=1;i<=n;i++)
	 if (i%2==1) printf("%d ",i);
	for (i=n;i>=1;i--)
	 if (i%2==1&&i!=n) printf("%d ",i);
	for (i=1;i<=n;i++)
	 if (i%2==0) printf("%d ",i);
	for (i=n;i>=1;i--)
	 if (i%2==0&&i!=n) printf("%d ",i);
	printf("%d",n);
}


#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
int ans[1000005];
int main()
{
	int n;
	cin >> n;
	for (int i = 1; i < n; i += 2)
	{
		ans[(i + 1) / 2] = i;
		ans[n + 1 - (i + 1) / 2] = i;
	}
	for (int i = 2; i < n; i += 2)
	{
		ans[n + i / 2] = i;
		ans[2 * n - i / 2] = i;
	}
	for (int i = 1; i <= 2 * n; i++)
		if (!ans[i])
			ans[i] = n;
	for (int i = 1; i <= 2 * n; i++)
		cout << ans[i] << " ";
	return 0;

}


#include <iostream>
#include <fstream>
#include <float.h>
#include <cmath>
#include <string.h>
#include <algorithm>
#include <vector>
#include <limits>

using namespace std;

typedef long int li;
typedef long long ll;
typedef long double ld;

#define endl "\n"
#define largePrime 1000000007
#define rep(i,s,n) for(i=s;i<n;i++)
#define rept(t) cin>>t;while(t--)
#define repn(n) for(int i=0;i<n;i++)
#define zero(arr,n) memset(arr,0,(n)*sizeof(*arr))

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    //ifstream cin("input.txt");
    //ofstream cout("output.txt");
    int n,i,start;
    cin>>n;
    rep(start,1,3)
    {
        for(i = start; i<=n; i += 2)
            cout<<i<<" ";
        for(i = (i==n+2? n - 2 : n - 1); i>0; i -= 2)
            cout<<i<<" ";
    }
    cout<<n<<endl;
    return 0;
}


#include <iostream>
#include <fstream>
#include <float.h>
#include <cmath>
#include <string.h>
#include <algorithm>
#include <vector>
#include <limits>

using namespace std;

typedef long int li;
typedef long long ll;
typedef long double ld;

#define endl "\n"
#define largePrime (int)1e9 + 7
#define rep(i,s,n) for(i=s;i<n;i++)
#define rept(t) cin>>t;while(t--)
#define repn(n) for(int i=0;i<n;i++)
#define zero(arr,n) memset(arr,0,(n)*sizeof(*arr))

void Out(int a)
{
  if(a>9)
      Out(a/10);
  putchar(a%10+'0');
}

int main()
{
    //ios_base::sync_with_stdio(false);
    //cin.tie(NULL);
    //ifstream cin("input.txt");
    //ofstream cout("output.txt");
    int n,i,start;
    cin>>n;
    rep(start,1,3)
    {
        for(i = start; i<=n; i += 2)
            Out(i);putchar(' ');
        for(i = (i==n+2? n - 2 : n - 1); i>0; i -= 2)
            Out(i);putchar(' ');
    }
    Out(n);putchar('\n');
    return 0;
}


#include <iostream>
#include <fstream>
#include <float.h>
#include <cmath>
#include <string.h>
#include <algorithm>
#include <vector>
#include <limits>

using namespace std;

typedef long int li;
typedef long long ll;
typedef long double ld;

#define endl "\n"
#define largePrime (int)1e9 + 7
#define rep(i,s,n) for(i=s;i<n;i++)
#define rept(t) cin>>t;while(t--)
#define repn(n) for(int i=0;i<n;i++)
#define zero(arr,n) memset(arr,0,(n)*sizeof(*arr))

void Out(int a)
{
  if(a>9)
      Out(a/10);
  putchar(a%10+'0');
}

int main()
{
    //ios_base::sync_with_stdio(false);
    //cin.tie(NULL);
    //ifstream cin("input.txt");
    //ofstream cout("output.txt");
    int n,i,start;
    cin>>n;
    rep(start,1,3)
    {
        for(i = start; i<=n; i += 2)
        {
            Out(i);putchar(' ');
        }
        for(i = (i==n+2? n - 2 : n - 1); i>0; i -= 2)
        {
            Out(i);putchar(' ');
        }
    }
    Out(n);putchar('\n');
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

#define ll long long
#define f first
#define s second
#define ull unsigned long long
#define mp make_pair
#define pb push_back

const ll MXN = 1e6 + 1;
const ll INF = 1e9 * 2;
const double EPS = 1e-9;

ll n, a[MXN], ans, res, x;

int main()
{
    // freopen("dminmax.in", "r", stdin);
    // freopen("dminmax.out", "w", stdout);
    cin >> n;
    for(int i = 1; i <= n; i++){
        cout << i << ' ' << i << ' ';
    }
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

#define ll long long
#define f first
#define s second
#define ull unsigned long long
#define mp make_pair
#define pb push_back

const ll MXN = 1e6 + 1;
const ll INF = 1e9 * 2;
const double EPS = 1e-9;

ll n, ans, res, cnt, tnt, a[MXN];

int main()
{
    // freopen("dminmax.in", "r", stdin);
    // freopen("dminmax.out", "w", stdout);
    cin >> n;
    if(n == 2){
        cout << "1 1 2 2";
        return 0;
    }
    ans = 1;
    res = 2 * n / 2;
    cnt = 2 * n / 2 + 1;
    tnt = 2 * n;
    for(int i = 1; i < n; i++){
        if(i % 2 == 1){
            a[ans] = i;
            a[res] = i;
            ans++;
            res--;
        }
        else{
            a[cnt] = i;
            a[tnt] = i;
            cnt++;
            tnt--;
        }
    }
    a[ans] = n;
    a[cnt] = n;
    for(int i = 1; i <= n * 2; i++){
        cout << a[i] << ' ';
    }
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

#define ll long long
#define f first
#define s second
#define ull unsigned long long
#define mp make_pair
#define pb push_back

const ll MXN = 1e6 + 1;
const ll INF = 1e9 * 2;
const double EPS = 1e-9;

ll n, a[MXN], ans, res, x;

int main()
{
    // freopen("dminmax.in", "r", stdin);
    // freopen("dminmax.out", "w", stdout);
    cin >> n;
    for(int i = 1; i <= n; i++){
        cout << i << ' ' i << ' ';
    }
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

#define ll long long
#define f first
#define s second
#define ull unsigned long long
#define mp make_pair
#define pb push_back

const ll MXN = 1e6 + 1;
const ll INF = 1e9 * 2;
const double EPS = 1e-9;

ll n, a[MXN], ans = 1, res;
set <int> st;

int main()
{
    // freopen("dminmax.in", "r", stdin);
    // freopen("dminmax.out", "w", stdout);
    cin >> n;
    for(int i = 1; i <= n * 2; i++){
        st.insert(i);
    }
    while(!st.empty()){
        int x = (n - ans) + 1;
        a[*st.begin()] = ans;
        st.erase(*st.begin());
        set<int>::iterator it = st.upper_bound(x);
        set<int>::iterator it2 = st.lower_bound(x);
        if(*it - x < *it2 - x){
            res = *it;
        }
        else{
            res = *it2;
        }
        a[res] = ans;
        st.erase(res);
        ans++;
    }
    for(int i = 1; i <= 2 * n; i++){
        cout << a[i] << ' ';
    }
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

#define ll long long
#define f first
#define s second
#define ull unsigned long long
#define mp make_pair
#define pb push_back

const ll MXN = 1e6 + 1;
const ll INF = 1e9 * 2;
const double EPS = 1e-9;

ll n, ans, res, cnt, tnt, a[MXN];

int main()
{
    // freopen("dminmax.in", "r", stdin);
    // freopen("dminmax.out", "w", stdout);
    cin >> n;
    ans = 1;
    res = 2 * n / 2;
    cnt = 2 * n / 2 + 1;
    tnt = 2 * n - 1;
    for(int i = 1; i < n; i++){
        if(i % 2 == 1){
            a[ans] = i;
            a[res] = i;
            ans++;
            res--;
        }
        else{
            a[cnt] = i;
            a[tnt] = i;
            cnt++;
            tnt--;
        }
    }
    for(int i = 1; i < n * 2; i++){
        if(a[i] == 0){
            cnt = i;
        }
    }
    a[cnt] = n;
    a[n * 2] = n;
    for(int i = 1; i <= n * 2; i++){
        cout << a[i] << ' ';
    }
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

const int N = 2e6 + 6;

int n, a[N];

bool used[N];

int main()
{
  scanf("%d", &n);
  for (int i = 1;i < n;i++)
  	for (int j = 1;j <= n + n;j++)
  		if (a[j] == 0 && j + (n - i) <= n + n && a[j + (n - i)] == 0)
  		{
  			a[j] = a[j + (n - i)] = i;
  			break;
  		}
  for (int i = 1;i <= n + n;i++) if (a[i] == 0) a[i] = n;
  for (int i = 1;i <= n + n;i++) printf("%d ", a[i]);
	return 0;
}


#include <bits/stdc++.h>

using namespace std;

const int N = 2e6 + 6;

int n, a[N];

int main()
{
  scanf("%d", &n);
  int cur = 1;
  for (int i = 1;i <= n + n;i++)
 	{
 		int d = n - cur;
 		if (cur < n && i > d && a[i - d] == 0 && a[i] == 0)
 		{
 			a[i] = cur;
			a[i - d] = cur;
 			cur++;
 		}
	}
	int cnt = 0;
	for (int i = 1;i <= n + n;i++)
		if (a[i] == 0)
		{
			cnt++;
			a[i] = cur;
		}
	assert(cnt == 2);
 	for (int i = 1;i <= n + n;i++) printf("%d ", a[i]);
	return 0;
}


#include <bits/stdc++.h>

using namespace std;

const int N = 2e6 + 6;

int n, a[N];

bool used[N];

int main()
{
  scanf("%d", &n);
  set < int > st;
  for (int i = 1;i <= n + n;i++) st.insert(i);
  set < int > s;
  for (int i = 1;i < n;i++) s.insert(i);
  while(st.size() > 2)
  {
  	int i = *st.begin(); st.erase(i);
  	int j = *st.begin();
  	int x = j - i;
  	int p = *s.lower_bound(n - x);
  //	cout << "i = " << i << " p = " << p << endl;
  	s.erase(p);
//  	cout << "i = " << i << " p = " << p << " j = " << (i + (n - p)) << endl;
  	a[i] = a[i + (n - p)] = p;
  	st.erase(i + (n - p));
  }
  assert(st.size() == 2);
  for (auto i : st) a[i] = n;
  for (int i = 1;i <= n + n;i++) printf("%d ", a[i]);
	return 0;
}


#include <bits/stdc++.h>

using namespace std;

const int N = 2e6 + 6;

int n, a[N];

int main()
{
  scanf("%d", &n);
  for (int i = 1;i <= n + n;i++) scanf("%d", &a[i]);
  for (int i = n;i;i--) printf("%d ", i);
  for (int i = 1;i <= n;i++) printf("%d ", i);
	return 0;
}


#include <bits/stdc++.h>

using namespace std;

const int N = 2e6 + 6;

int n, a[N];

int main()
{
  scanf("%d", &n);
  for (int i = 1;i <= n + n;i++) scanf("%d", &a[i]);
  sort(a + 1, a + n + n + 1);
  for (int i = 1;i <= n + n;i++) printf("%d ", a[i]);
	return 0;
}


#include <bits/stdc++.h>

using namespace std;

const int N = 2e6 + 6;

int n, a[N];

int main()
{
  scanf("%d", &n);
  for (int i = 1;i <= n;i++) printf("%d %d ", i, i);
	return 0;
}


#include <bits/stdc++.h>

using namespace std;

const int N = 2e6 + 6;

int n, a[N];

int main()
{
  scanf("%d", &n);
 	int l = 1, r = n + 1;
 	for (int i = 1;i < n;i++)
 		if (i & 1)
 		{
 			a[r] = a[r + n - i] = i;
 			r++;
 		}
 		else
 		{
 			a[l] = a[l + n - i] = i;
 			l++;
 		}
 	for (int i = 1;i <= n + n;i++) if (a[i] == 0) a[i] = n;
 	for (int i = 1;i <= n + n;i++) printf("%d ", a[i]);
	return 0;
}


#define _CRT_SECURE_NO_WARNINGS
#pragma comment(linker, "/STACK:256000000")
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cstring>
#include <algorithm>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <bitset>
#include <unordered_map>
#include <unordered_set>

using namespace std;

typedef long long ll;
typedef pair <int, int> pii;
typedef vector <int> vi;
typedef set <int> si;
typedef pair <ll, ll> pll;
typedef vector <ll> vll;
typedef set <ll> sll;

#define forn(i, n) for (int i = 0; i < (int)n; ++i)
#define forq(i, q, n) for (int i = (int)q; i < (int)n; ++i)
#define forb(i, n, q) for (int i = (int)n; i >= (int)q; ++i)
#define fornll(i, n) for (ll i = 0; i < (ll)n; ++i)
#define forqll(i, q, n) for (ll i = (ll)q; i < (ll)n; ++i)
#define forbll(i, n, q) for (ll i = (ll)n; i >= (ll)q; ++i)
#define mk make_pair
#define psh push_back
#define all(v) v.begin(), v.end()
#define TIME clock() * 1.0 / CLOCKS_PER_SEC
#define TASK ""
#define X first
#define Y second

const int INF = (int)1e9 + 7;
const int MOD = (int)1e9 + 7;
const double EPS = (double)1e-5;

vi a[(int)1e6 + 1], b[(int)1e6 + 1];

int main()
{
	//freopen(TASK".in", "r", stdin);
	//freopen(TASK".out", "w", stdout);
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	int n;
	scanf("%d", &n);
	for (int i = n; i > 0; --i)
		cout << i << " ";
	forq(i, 1, n + 1)
		cout << i << " ";
	return 0;
}


#define _CRT_SECURE_NO_WARNINGS
#pragma comment(linker, "/STACK:256000000")
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cstring>
#include <algorithm>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <bitset>
#include <unordered_map>
#include <unordered_set>

using namespace std;

typedef long long ll;
typedef pair <int, int> pii;
typedef vector <int> vi;
typedef set <int> si;
typedef pair <ll, ll> pll;
typedef vector <ll> vll;
typedef set <ll> sll;

#define forn(i, n) for (int i = 0; i < (int)n; ++i)
#define forq(i, q, n) for (int i = (int)q; i < (int)n; ++i)
#define forb(i, n, q) for (int i = (int)n; i >= (int)q; ++i)
#define fornll(i, n) for (ll i = 0; i < (ll)n; ++i)
#define forqll(i, q, n) for (ll i = (ll)q; i < (ll)n; ++i)
#define forbll(i, n, q) for (ll i = (ll)n; i >= (ll)q; ++i)
#define mk make_pair
#define psh push_back
#define all(v) v.begin(), v.end()
#define TIME clock() * 1.0 / CLOCKS_PER_SEC
#define TASK ""
#define X first
#define Y second

const int INF = (int)1e9 + 7;
const int MOD = (int)1e9 + 7;
const double EPS = (double)1e-5;

vi a[(int)1e6 + 1], b[(int)1e6 + 1];

int main()
{
	//freopen(TASK".in", "r", stdin);
	//freopen(TASK".out", "w", stdout);
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
	int n;
	scanf("%d", &n);
	for (int i = n; i > 0; --i)
		cout << i << " ";
	forq(i, 1, n + 1)
		cout << i << " ";
	return 0;
}


#define _CRT_SECURE_NO_WARNINGS
#pragma comment(linker, "/STACK:256000000")
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cstring>
#include <algorithm>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <bitset>
#include <unordered_map>
#include <unordered_set>

using namespace std;

typedef long long ll;
typedef pair <int, int> pii;
typedef vector <int> vi;
typedef set <int> si;
typedef pair <ll, ll> pll;
typedef vector <ll> vll;
typedef set <ll> sll;

#define forn(i, n) for (int i = 0; i < (int)n; ++i)
#define forq(i, q, n) for (int i = (int)q; i < (int)n; ++i)
#define forb(i, n, q) for (int i = (int)n; i >= (int)q; ++i)
#define fornll(i, n) for (ll i = 0; i < (ll)n; ++i)
#define forqll(i, q, n) for (ll i = (ll)q; i < (ll)n; ++i)
#define forbll(i, n, q) for (ll i = (ll)n; i >= (ll)q; ++i)
#define mk make_pair
#define psh push_back
#define all(v) v.begin(), v.end()
#define TIME clock() * 1.0 / CLOCKS_PER_SEC
#define TASK ""
#define X first
#define Y second

const int INF = (int)1e9 + 7;
const int MOD = (int)1e9 + 7;
const double EPS = (double)1e-5;

int main()
{
	//freopen(TASK".in", "r", stdin);
	//freopen(TASK".out", "w", stdout);
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	int n;
	cin >> n;
	if (n % 2)
	{
		for (int i = 1; i <= n; i += 2)
			cout << i << " ";
		for (int i = n - 2; i >= 1; i -= 2)
			cout << i << " ";
		for (int i = 2; i < n; i += 2)
			cout << i << " ";
		for (int i = n - 1; i >= 2; i -= 2)
			cout << i << " ";
		cout << n;
	}
	else
	{
		for (int i = 1; i < n; i += 2)
			cout << i << " ";
		for (int i = n - 1; i >= 1; i -= 2)
			cout << i << " ";
		for (int i = 2; i <= n; i += 2)
			cout << i << " ";
		for (int i = n - 2; i >= 2; i -= 2)
			cout << i << " ";
		cout << n;
	}
	return 0;
}