#include <bits/stdc++.h>
#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace std;
int main() {
  long long a, b, c;
  cin >> a >> b;
  vector<long long> v, v1;
  long long s = 0, k;
  for (long long i = 0; i < a; i++) {
    cin >> k;
    if (k < 0)
      v1.push_back(k);
    else {
      v.push_back(k);
      s += k;
    }
  }
  long long ans = s;
  long long r = 0;
  if (v1.size() > 0 && v.size() > 0)
    r = min(abs(v1[v1.size() - 1]), v[0]);
  else if (v1.size() > 0)
    r = (-1) * v1[v1.size() - 1];
  if (v1.size() == 0 && b % 2 == 0)
    ans = s;
  else if (v1.size() == 0 && b % 2 == 1)
    ans -= 2 * v[0];
  else {
    if ((v1.size() + b) % 2 == 0 || b < v1.size()) {
      for (long long i = 0; i < v1.size(); i++) {
        if (b > 0) {
          ans += abs(v1[i]);
          b--;
        } else
          ans += v1[i];
      }
    } else {
      for (long long i = 0; i < v1.size(); i++) {
        if (b > 0) {
          ans += abs(v1[i]);
          b--;
        } else
          ans += v1[i];
      }
      ans -= 2 * r;
    }
  }
  cout << ans;
  return 0;
}
