#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k;
  int a[100000];
  cin >> n >> k;
  for (int i = 0; i < n; i++) cin >> a[i];
  sort(a, a + n, greater<int>());
  int res = 0;
  for (int i = 0; i < n; i++) {
    if (a[i] >= 0)
      res += a[i];
    else {
      if (k % 2 == 1) res += a[i];
      break;
    }
  }
  cout << max(0, res) << endl;
  return 0;
}
