#include <bits/stdc++.h>
using namespace std;
vector<long long> v;
bool isPrime(int n) {
  if (n <= 1) return false;
  if (n <= 3) return true;
  if (n % 2 == 0 || n % 3 == 0) return false;
  for (int i = 5; i * i <= n; i = i + 6)
    if (n % i == 0 || n % (i + 2) == 0) return false;
  return true;
}
unsigned int factorial(unsigned int n) {
  if (n == 0) return 1;
  return n * factorial(n - 1);
}
long long gcd(long long int a, long long int b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
long long lcm(int a, int b) { return (a / gcd(a, b)) * b; }
void permutation(long long n, long long x) {
  if (n == 0) return;
  long long x1 = x * 10 + 4, x2 = x * 10 + 7;
  v.push_back(x1);
  v.push_back(x2);
  permutation(n - 1, x1);
  permutation(n - 1, x2);
}
bool is_lucky(long long n) {
  while (n) {
    long long rem = n % 10;
    if (rem != 4 && rem != 7) {
      return 0;
    }
    n /= 10;
  }
  return 1;
}
long long Lucky_num(long long n) {
  if (is_lucky(n)) {
    return n;
  }
  long long x = n;
  long long digits = 0;
  while (x) {
    x /= 10;
    digits++;
  }
  long long t1 = 0, t2 = 0;
  for (int i = 0; i < digits; i++) {
    t1 = t1 * 10 + 4;
    t2 = t2 * 10 + 7;
  }
  string s1 = "", s2 = "";
  if (n > t2)
    t1 = t1 * 10 + 4;
  else {
    s1 = to_string(n), s2 = to_string(t1);
    for (int i = 0; i < s1.length(); i++) {
      if (s1[i] != '7') break;
      s2[i] = '7';
    }
    for (int i = s2.length() - 1; i >= 0; i--) {
      if (s2 < s1) {
        string s3 = s2;
        s3[i] = '7';
        if (s3 >= s1) {
          s2 = s3;
          break;
        }
      } else {
        break;
      }
    }
    t1 = stoll(s2);
  }
  return t1;
}
void SieveOfEratosthenes(int n) {
  bool prime[n + 1];
  memset(prime, true, sizeof(prime));
  for (int p = 2; p * p <= n; p++) {
    if (prime[p] == true) {
      for (int i = p * p; i <= n; i += p) prime[i] = false;
    }
  }
  for (int p = 2; p <= n; p++)
    if (prime[p]) v.push_back(p);
}
int main() {
  long long n, k;
  cin >> n >> k;
  vector<long long> pos, neg;
  long long sum = 0;
  for (int i = 0; i < n; i++) {
    long long x;
    cin >> x;
    if (x >= 0)
      pos.push_back(x), sum += x;
    else
      neg.push_back(x);
  }
  sort(pos.begin(), pos.end());
  sort(neg.begin(), neg.end());
  int i = 0;
  while (k) {
    if (i == neg.size()) break;
    sum += abs(neg[i]);
    neg[i] = -1 * neg[i];
    k--, i++;
  }
  while (i < neg.size()) {
    sum += neg[i++];
  }
  if (k > 0) {
    if (k & 1) {
      long long temp = 0;
      if (neg.size() == 0) {
        temp = pos[0];
      } else if (pos.size() == 0) {
        temp = neg[neg.size() - 1];
      } else if (neg.size() != 0 && pos.size() != 0) {
        long long x = abs(neg[neg.size() - 1]);
        temp = min(x, pos[0]);
      }
      sum -= (temp * 2);
    }
  }
  cout << sum << endl;
}
