#include <bits/stdc++.h>
using namespace std;

// Loops
#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for (int i = int(a); i < int(b); ++i)
#define _rrep(i, n) rrepi(i, n, 0)
#define rrepi(i, a, b) for (int i = int(a) - 1; i >= int(b); --i)

#define rep(...) _overload3(__VA_ARGS__, repi, _rep, )(__VA_ARGS__)
#define rrep(...) _overload3(__VA_ARGS__, rrepi, _rrep, )(__VA_ARGS__)
#define each(xi, x) for (auto &&xi : x)
// Note: we can use rep(i,N) or rep(i,from,to)

// typedef
template <class T> using vec = vector<T>;
using ll = long long;
using vi = vec<ll>;
using vvi = vec<vi>;
using vvvi = vec<vvi>;
using pii = pair<ll, ll>;

// Constants

// Shorter repr for frequently used terms
#define pb push_back
#define mp make_pair

// Algorithms
#define all(x) (x).begin(), (x).end()
#define uniq(v) v.erase(unique(all(v)), v.end())
#define perm(c)                                                                \
  sort(all(c));                                                                \
  for (bool c##p = 1; c##p; c##p = next_permutation(all(c)))

template <class T> pair<T, size_t> max(vector<T> &x) {
  auto it = max_element(all(x));
  return mp(*it, it - x.begin());
}
template <class T> pair<T, size_t> min(vector<T> &x) {
  auto it = min_element(all(x));
  return mp(*it, it - x.begin());
}

template <class T> inline bool chmax(T &maxval, const T &newval) {
  if (maxval < newval) {
    maxval = newval;
    return 1;
  }
  return 0;
}
template <class T> inline bool chmin(T &minval, const T &newval) {
  if (minval > newval) {
    minval = newval;
    return 1;
  }
  return 0;
}

// Utilities
// Grid world utilities
int dx[4] = {0, 1, 0, -1};
int dy[4] = {1, 0, -1, 0};
#define inside(H, W, y, x) 0 <= (x) && (x) < (W) && 0 <= (y) && (y) < (H)

// Debug
#ifdef LOCAL
#include "dump.hpp"
#define debug(x) cerr << #x << ": " << x << '\n'
#else
#define dump(...)
#define debug(x)
#endif

// Yes or No
void yesno(bool ok, string yes = "Yes", string no = "No") {
  cout << (ok ? yes : no) << endl;
}

// Paste snippets here!!

//

void solve(long long N, long long K, std::vector<long long> x) {
  vec<ll> x_neg;
  vec<ll> x_pos;
  rep(i,N){
    if(x[i]<0) x_neg.pb(-x[i]);
    else if(x[i]>0) x_pos.pb(x[i]);
    else K--;  // 座標ゼロにあるときは実質的に K を間引ける
  }
  reverse(all(x_neg));

  if(x_neg.size()==0 && x_pos.size()==0) {
    cout << 0 << endl; return;
  }
  if(x_neg.size()==0){
    cout << x_pos[K-1] << endl;
    return;
  }
  if(x_pos.size()==0){
    cout << x_neg[K-1] << endl;
    return;
  }

  // どの地点で折り返すのが最適か？
  ll ret = numeric_limits<ll>::max();
  // (1) 最初に負の方向に進んで i+1 個目で折り返す
  for(int i=0;i<x_neg.size();++i){
    if(i==K) break;
    
    // 残り K-i-1 個
    if(K-i-1>x_pos.size()) continue;
    ll cost = 2*x_neg[i];
    cost += x_pos[K-i-2];
    if(cost<ret) ret = cost;
  }
  // (2) 最初に正の方向に進む
  for(int i=0;i<x_pos.size();++i){
    if(i==K) break;
    
    // 残り K-i-1 個
    if(K-i-1>x_neg.size()) continue;
    ll cost = 2*x_pos[i];
    cost += x_neg[K-i-2];
    if(cost<ret) ret = cost;
  }
  cout << ret << endl;
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false); // Magic for faster cin
  cout.precision(12);
  long long N;
  std::cin >> N;
  long long K;
  std::cin >> K;
  std::vector<long long> x(N);
  for (int i = 0; i < N; i++) {
    std::cin >> x[i];
  }
  solve(N, K, std::move(x));
  return 0;
}


Measured memory_bytes: 5344