#include <bits/stdc++.h>
using namespace std;
int n, k;
void solve() {
  cin >> n >> k;
  vector<int> a(n);
  int ind = -1;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    if (a[i] <= 0) {
      ind = i;
    }
  }
  int sum = 0;
  if (k >= ind + 1) {
    for (int i = 0; i < ind + 1; i++) sum += abs(a[i]);
    for (int i = ind + 1; i < n; i++) sum += a[i];
    k -= (ind + 1);
    if (k % 2) {
      if (ind + 1 > 0) {
        if (ind < n - 1) {
          int mini = min(abs(a[ind]), a[ind + 1]);
          sum -= 2 * mini;
        } else
          sum += 2 * a[ind];
      } else
        sum -= 2 * a[0];
    }
  } else {
    for (int i = 0; i < k; i++) sum += abs(a[i]);
    for (int i = k; i < n; i++) sum += a[i];
  }
  cout << sum;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  solve();
  return 0;
}
