#include using namespace std; #define REP(i,n) for(int i=0; i<(int)(n); i++) int main() { ios_base::sync_with_stdio(0); cin.tie(0); int n, m; cin >> n >> m; vector D(m); REP (i, m) cin >> D[i]; sort(D.begin(), D.end()); int ret = 1e8; for (int i = 0; i + n - 1 < m; i++) { int j = i + n - 1; if (D[i] * D[j] >= 0) { ret = min(ret, max(abs(D[i]), abs(D[j]))); } else { ret = min(ret, 2 * abs(D[i]) + abs(D[j])); ret = min(ret, abs(D[i]) + 2 * abs(D[j])); } } cout << ret << endl; return 0; }