#include <bits/stdc++.h>
using namespace std;
int a[100005];
int main() {
  int n, k, x, sum;
  scanf("%d %d", &n, &k);
  for (int i = 0; i < (n); i++) scanf("%d", &a[i]);
  int ng = 0, ps = 0, nm = -(1 << 28), pm = (1 << 28);
  for (int i = 0; i < (n); i++) {
    if (a[i] < 0)
      ng++;
    else
      ps++;
    if (a[i] < 0 && a[i] > nm)
      nm = a[i];
    else if (a[i] >= 0 && a[i] < pm)
      pm = a[i];
  }
  if (ng >= k) {
    sum = 0;
    for (int i = 0; i < (n); i++) {
      if (i < k)
        sum += ((a[i]) < 0 ? -(a[i]) : (a[i]));
      else
        sum += a[i];
    }
  } else {
    sum = 0;
    for (int i = 0; i < (n); i++) {
      sum += ((a[i]) < 0 ? -(a[i]) : (a[i]));
    }
    if ((k - ng) & 1) {
      if (!ng)
        sum = sum - 2 * a[0];
      else
        sum = ((sum + 2 * nm > sum - 2 * pm) ? (sum + 2 * nm) : (sum - 2 * pm));
    }
  }
  printf("%d\n", sum);
  return 0;
}
