import std.algorithm;
import std.array;
import std.conv;
import std.math;
import std.range;
import std.stdio;
import std.string;

long test () {
  int n, k;
  readf (" %d %d", &n, &k);
  int[] neg, pos;
  foreach (t; 0 .. n) {
    int x;
    readf (" %d", &x);
    if (x < 0) neg ~= -x;
    else if (x > 0) pos ~= x;
    else --k;
  }
  if (k <= 0) return 0;
  reverse (neg);
  auto nl = neg.length;
  auto pl = pos.length;
  long res = long.max;
  void upd (ulong x) {
    if (res > x) res = x;
  }
  if (k <= nl) upd (neg[k-1]);
  if (k <= pl) upd (pos[k-1]);
  debug stderr.writeln (neg);
  debug stderr.writeln (pos);

  foreach (i; 1 .. min (k, nl+1)) {
    auto j = k - i;
    if (j <= pl) {
      upd (2 * neg[i-1] + pos[j-1]);
      upd (neg[i-1] + 2 * pos[j-1]);
    }
  }
  return res;
}

void main() {
  writeln (test ());
}

