#include <bits/stdc++.h>
using namespace std;
void debug() {}
void sol();
int main() {
  debug();
  sol();
  return 0;
}
const int inf = 0x3f3f3f3f;
const int mod = 1e9 + 7;
const double eps = 1e-8;
int a[100005];
void sol() {
  int n, k;
  while (cin >> n >> k) {
    for (int i = 0; i < n; i++) {
      scanf("%d", &a[i]);
    }
    int j = lower_bound(a, a + n, 0) - a;
    long long sum = 0;
    if (k <= j) {
      int i;
      for (i = 0; i < k && a[i] < 0; i++) sum += -a[i];
      for (; i < n; i++) sum += a[i];
      cout << sum << endl;
      continue;
    }
    k -= j;
    for (int i = 0; i < j; i++) a[i] = -a[i];
    for (int i = 0; i < n; i++) sum += a[i];
    if (k & 1) {
      if (j == 0)
        sum -= 2 * a[j];
      else if (j == n)
        sum -= 2 * a[j - 1];
      else
        sum -= min(a[j], a[j - 1]) * 2;
    }
    cout << sum << endl;
  }
}
