problem

Given a sequence $ A $ of length $ N $. You can swap the $ i $ th and $ j $ th ($ 0 \ leq i, j \ leq N-1 $) elements of a sequence up to $ M $ times.

Find the maximum value of $ \ sum_ {i = 0} ^ {N -1} abs (A_i --i) $ in the sequence created by the operation.



output

Find the maximum value of $ \ sum_ {i = 0} ^ {N --1} abs (A_i --i) $ in the sequence created by the operation. Also, output a line feed at the end.

Example

Input

5 2
0 3 2 1 4


Output

12
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
typedef long long ll;
typedef pair<int,int> pint;
typedef pair<ll,int> pli;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;

int main(){
    int n,m;
    cin>>n>>m;
    int a[n];
    rep(i,n)cin>>a[i];
    int b[n];
    rep(i,n)b[i]=i;
    vector<int> ord(2*n);
    iota(ord.begin(),ord.end(),0);
    sort(ord.begin(),ord.end(),[&](int x,int y){
        int xx=(x<n?a[x] : b[x-n]);
        int yy=(y<n?a[y] : b[y-n]);
        return xx>yy;
    });
    vector<int> usea(n), useb(n);
    rep(i,n){
        if(ord[i]<n)usea[ord[i]]=1;
        else useb[ord[i]-n]=1;
    }
    priority_queue<int> ma,mi;
    ll ans=0;
    rep(i,n){
        if(usea[i]&&useb[i])ma.push(min(a[i],b[i]));
        if(!usea[i]&&!useb[i])mi.push(min(-a[i],-b[i]));
        ans+=abs(a[i]-b[i]);
    }
    m=min(m, (int)ma.size());
    rep(i,m){
        int x=ma.top(), y=mi.top();
        ma.pop();mi.pop();
        ans+=2*(x+y);
    }
    cout<<ans<<endl;

    return 0;
}
