#include using namespace std; signed main(){ int N, M; cin >> N >> M; vector< int > D( M ); for( int i = 0; i < M; ++i ) cin >> D[ i ]; sort( D.begin(), D.end() ); int ans = 0x3f3f3f3f; for( int i = N - 1; i < M; ++i ){ if( D[ i - ( N - 1 ) ] * D[ i ] < 0 ) ans = min( ans, 2 * min( -D[ i - ( N - 1 ) ], D[ i ] ) + max( -D[ i - ( N - 1 ) ], D[ i ] ) ); else ans = min( ans, D[ i ] - D[ i - ( N - 1 ) ] ); } cout << ans << endl; return 0; }