#include <bits/stdc++.h>
void siftDown(int numbers[], int root, int bottom) {
  int maxChild = root * 2 + 1;
  if (maxChild < bottom) {
    int otherChild = maxChild + 1;
    maxChild =
        (numbers[otherChild] > numbers[maxChild]) ? otherChild : maxChild;
  } else {
    if (maxChild > bottom) return;
  }
  if (numbers[root] >= numbers[maxChild]) return;
  int temp = numbers[root];
  numbers[root] = numbers[maxChild];
  numbers[maxChild] = temp;
  siftDown(numbers, maxChild, bottom);
}
void heapSort1(int numbers[], int array_size) {
  int i, temp;
  for (i = (array_size / 2); i >= 0; i--) {
    siftDown(numbers, i, array_size - 1);
  }
  for (i = array_size - 1; i >= 1; i--) {
    temp = numbers[0];
    numbers[0] = numbers[i];
    numbers[i] = temp;
    siftDown(numbers, 0, i - 1);
  }
}
int main() {
  int n, k, i = 0, sum = 0;
  scanf("%d%d", &n, &k);
  int a[n];
  while (i < n) {
    scanf("%d", &a[i]);
    i++;
  }
  i = 0;
  while (i < n && k > 0 && a[i] < 0) {
    a[i] = (-a[i]);
    k--;
    i++;
  }
  while (i < n && a[i] == 0 && k > 0) {
    k--;
  }
  heapSort1(a, n);
  i = 0;
  while (k) {
    a[i] = (-a[i]);
    k--;
  }
  i = 0;
  while (i < n) {
    sum += a[i];
    i++;
  }
  printf("%d\n", sum);
  return 0;
}
