//Solution By SlavicG
#include "bits/stdc++.h"
using namespace std;
#define ll long long
#define forn(i,n) for(int i=0;i<n;i++)
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(),v.rend()
#define pb push_back
#define sz(a) (int)a.size()
#define fastio ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define endl "\n"
int gcd(int a, int b)
{
if (a==0) return b;
if (b == 0)return a;
if (a == b)return a;
if (a > b)return gcd(a-b, b);
return gcd(a, b-a);
}
int main()
{
int n,k;
cin >> n >> k;
int a[n];
for(int i = 0;i < n;i++)
cin >> a[i];
if(k%2==0){
cout << "NO\n";
return 0;
}
int prefixGcd[n],suffixGcd[n];
prefixGcd[0] = a[0];
suffixGcd[n-1] = a[n-1];
for(int i = 1 ;i < n;i++){
prefixGcd[i] = gcd(prefixGcd[i-1],a[i]);
}
for(int i = n-2;i>=0;i--){
suffixGcd[i] = gcd(suffixGcd[i+1],a[i]);
}
for(int i = 1;i < n - 1 ;i++){
if(gcd(prefixGcd[i-1], suffixGcd[i+1]) > 1){
cout << "YES\n";
return 0;
}
}
//Check for the element at index 0 and for the element at index n-1.
if(suffixGcd[1] > 1 || prefixGcd[n-2] > 1){
cout << "YES\n";
return 0;
}
cout << "NO\n";
}
Ly9Tb2x1dGlvbiBCeSBTbGF2aWNHCiNpbmNsdWRlICJiaXRzL3N0ZGMrKy5oIgp1c2luZyBuYW1lc3BhY2Ugc3RkOwogCiNkZWZpbmUgbGwgICAgICAgICAgICAgICAgICAgICAgICAgIGxvbmcgbG9uZwogCiNkZWZpbmUgZm9ybihpLG4pICAgICAgICAgICAgICAgICAgIGZvcihpbnQgaT0wO2k8bjtpKyspCiNkZWZpbmUgYWxsKHYpICAgICAgICAgICAgICAgICAgICAgIHYuYmVnaW4oKSwgdi5lbmQoKQojZGVmaW5lIHJhbGwodikgICAgICAgICAgICAgICAgICAgICB2LnJiZWdpbigpLHYucmVuZCgpCgkKI2RlZmluZSBwYiAgICAgICAgICAgICAgICAgICAgICAg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