#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long sum = 0, n, t, i = 0, neg = 0, temp, min = INT_MAX, k = 0;
  cin >> n >> t;
  int a[n];
  while (i < n) {
    cin >> temp;
    a[i++] = temp;
    sum += temp;
    if (min > temp and temp >= 0) min = temp;
    if (temp < 0) {
      neg++;
      sum -= 2 * temp;
      if (min > -temp) min = -temp;
    }
  }
  long long b = t;
  if (t == neg)
    cout << sum;
  else if (neg > t) {
    for (i = t; i < neg; i++) sum += 2 * a[i];
    cout << sum;
  } else {
    if ((t - neg) & 1) sum -= 2 * min;
    cout << sum;
  }
  return 0;
}
