#include <bits/stdc++.h>
using namespace std;
int partition(vector<int>& A, int p, int q) {
  int x = A[p];
  int i = p;
  int j;
  for (j = p + 1; j < q; j++) {
    if (A[j] <= x) {
      i = i + 1;
      swap(A[i], A[j]);
    }
  }
  swap(A[i], A[p]);
  return i;
}
void quickSort(vector<int>& A, int p, int q) {
  int r;
  if (p < q) {
    r = partition(A, p, q);
    quickSort(A, p, r);
    quickSort(A, r + 1, q);
  }
}
int binarySearch(int arr[], int siz, int x) {
  int start = 0, finish = siz - 1, mid = 0;
  while (start <= finish) {
    mid = (start + finish) / 2;
    if (arr[mid] == x) {
      return mid;
    }
    if (arr[mid] < x) {
      start = mid + 1;
    }
    if (arr[mid] > x) {
      finish = mid - 1;
    }
  }
  return -1;
}
int a[100000], n, k;
int main() {
  int i, sum = 0, count;
  cin >> n >> k;
  for (i = 0; i < n; i++) {
    cin >> a[i];
    sum = sum + a[i];
  }
  count = k;
  i = 0;
  while (count > 0) {
    if (i >= n) i--;
    if (a[i] > 0) {
      if (count % 2 != 0 && i != 0) {
        sum = sum - (2 * (a[i - 1] < a[i] ? a[i - 1] : a[i]));
      } else if (count % 2 != 0 && i == 0) {
        sum = sum - (2 * a[i]);
      }
      break;
    } else {
      a[i] = 0 - a[i];
      sum = sum + (2 * a[i]);
      i++;
      count--;
    }
  }
  cout << sum << endl;
  return 0;
}
