#include<iostream>
#include<algorithm>
using namespace std;
typedef long long LL;
const int N = 100010, mod = 1000000009;
int a[N];
int main() {
int n, k;
cin >> n >> k;
for (int i = 0; i < n;i++) {
cin >> a[i];
}
sort(a,a+n);
LL res = 1;
int l = 0, r = n - 1;
int sign = 1;
if (k%2) {
res = a[r];
r--;
k--;
if (res < 0) {
sign = -1;
}
}
while (k) {
LL x = LL(a[l] * a[l + 1]), y = LL(a[r]*a[r-1]);
if (x*sign >y *sign) {
res = x % mod * res % mod;
l += 2;
}
else {
res = y % mod * res % mod;
r -= 2;
}
k -= 2;
}
cout << res;
return 0;
}