#import <stdio.h>
#import <stdlib.h>
#import <limits.h>
typedef long long INT;

#define MAX(a,b) ((a)>(b)?(a):(b))
#define MIN(a,b) ((a)<(b)?(a):(b))

int compare_int(const void *a, const void *b) {
    return (int)(*(INT*)a - *(INT*)b);
}

int main() {
    INT N, K;
    scanf("%lld %lld", &N, &K);
    INT P[20] = {0};
    INT Q[20] = {0};

    INT x;
    INT p = 0;
    INT q = 0;
    while (scanf("%lld", &x) != EOF) {
        if(x>0) {
            P[p] = x;
            p++;
        } else if (x==0) {
            K--;
            N--;
        } else if (x<0) {
            Q[q] = -x;
            q++;
        }
    }
    
    qsort(Q, q, sizeof(INT), compare_int);
    
    INT min = LLONG_MAX;
    
    if (N==0) {
        min = 0;
    } else {
        if (p>=K) {
            min = P[K-1];
        }
        if (q>=K) {
            min = MIN(min,Q[K-1]);
        }
        for (INT i=MAX(1,K-q);i<=MIN(p,K-1);i++) {
            min = MIN(min, 2*P[i-1] + Q[K-i-1]);
        }
        for (INT i=MAX(1,K-p);i<=MIN(q,K-1);i++) {
            min = MIN(min, P[K-i-1] + 2*Q[i-1]);
        }
    }
    printf("%lld",min);

    return 0;

}
