#include<iostream> using namespace std; bool f(int m) { for (int i = 2; i < m; i++) if (m % i == 0) return 0; return 1; } void f1(int str[], int k,int n) { for(int i = 0; i < n; i++) for(int j = i + 1; j < n;j++) if (str[i] < str[j]) { int y = str[i]; str[i] = str[j]; str[j] = y; } } int main() { int n, k; cin >> n >> k; int str[10000]; for (int i = 0; i < n; i++) { int x; cin >> x; str[i] = x; } f1(str, k, n); int m = str[k - 1] - str[n - k]; if (f(m) == 1)cout << "YES" << endl; else cout << "NO" <<endl; cout << m << endl; return 0; }