#include<iostream>
#include<algorithm>
using namespace std;

int main(){
    int n, k, j=0, resultado;
    cin>> n >> k;
    int income[n];
    for(int i=0; i<n; i++)
        cin >> income[i];

//cambia los negaticos a positivos, y cuenta los cambio que hizo.
    for(int i=0 ; i<n ; i++){
    	if(income[i] < 0){
    		income[i] *= -1;
    		j++;
    		if(j == k) break;
    	}
    }

// k-> cambios que debo realizar. j-> cambios que ya realice.
// si queda una cantidad par de cambios, se pueden aplicar todas a un solo numero y queda igual. Entonces no hago cambios
// Si queda cantidad impar de cambios, aplico 1 cambio al menor elemento.
// si income era -7 2 5 ahora es 7 2 5, debo ordenar.
    if( (k-j) %2  ){
         sort(income, income + n);
        income[0] *= -1;
    }

//suma arreglo  despues de los cambios
    resultado=0;
    for(int i=0; i<n; i++)
        resultado+= income[i];

    cout << resultado<< endl;
    return 0;
}


#include<iostream>
#include<algorithm>
using namespace std;

int main(){
    int i, n, k, j=0, resultado=0;
    cin>> n >> k;
    int income[n];
    for(int i=0; i<n; i++)
        cin >> income[i];

//cambia los negaticos a positivos, y cuenta los cambio que hizo.
    for( i=0; i< k; i++){
        if( income[i] <0 ){
            income[i] = -1*income[i];
            j++;
        }
    }

//
//    cout<< "j es par? "<< j <<endl;
    if( (k-j) %2  ){
        sort(income, income + n);
        income[0]= -1*income[0];
    }

//suma la lista despues de los cambios
    for(int i=0; i<n; i++)
        resultado+= income[i];

    cout << resultado<< endl;
    return 0;
}


#include<iostream>
#include<algorithm>
using namespace std;

int main(){
    int n, k, j=0, resultado=0;
    cin>> n >> k;
    int income[n];
    for(int i=0; i<n; i++)
        cin >> income[i];

    for(int i=0; i< k; i++)
        if( income[i] <0 )
            income[i]= income[i] -1;
        else {
            j++;
//            cout<< j<< " ";
        }
//    cout <<endl;
    if( j%2 == 1 ){
        sort(income, income + n);
        income[0]= income[0] -1;
//        cout << income[0]<< endl;
    }

    for(int i=0; i<n; i++)
        resultado+= income[i];

    cout << resultado<< endl;
    return 0;
}


#include<iostream>
#include<algorithm>
using namespace std;

int main(){
    int n, k, j=0, resultado=0;
    cin>> n >> k;
    int income[n];
    for(int i=0; i<n; i++)
        cin >> income[i];

    for(int i=0; i< k; i++)
        if( income[i] <0 )
            income[i]*= -1;
        else {
            j++;
//            cout<< j<< " ";
        }
//    cout <<endl;
    if( j%2 ){
        sort(income, income + n);
        income[0]*= -1;
//        cout << income[0]<< endl;
    }

    for(int i=0; i<n; i++)
        resultado+= income[i];

    cout << resultado<< endl;
    return 0;
}


#include<iostream>
#include<algorithm>
using namespace std;

int main(){
    int i, n, k, j=0, resultado=0;
    cin>> n >> k;
    int income[n];
    for(int i=0; i<n; i++)
        cin >> income[i];

    for( i=0; i< k; i++)
        if( income[i] <0 ){
            income[i] = -1*income[i];
//            cout << income[i]<< " ";
        }
        else {
            j++;
//            cout<< j<< " ";
        }
//    cout <<endl;
    if( j %2  ){
        sort(income, income + n);
        income[0]= -1*income[0];
//        cout << income[0]<< endl;
    }

    for(int i=0; i<n; i++)
        resultado+= income[i];

    cout << resultado<< endl;
    return 0;
}


#include<iostream>
#include<algorithm>
using namespace std;

int main(){
    int n, k, j=0, resultado=0;
    cin>> n >> k;
    int income[n];
    for(int i=0; i<n; i++)
        cin >> income[i];

    for(int i=0; i< k; i++)
        if( income[i] <0 )
            income[i]*= -1;
        else j++;

    if( j%2 ){
        sort(income, income + n);
        income[0]*= -1;
    }

    for(int i=0; i<n; i++)
        resultado+= income[i];

    cout << resultado<< endl;
    return 0;
}


#include<iostream>
#include<algorithm>
using namespace std;

int main(){
    int i, n, k, j=0, resultado=0;
    cin>> n >> k;
    int income[n];
    for(int i=0; i<n; i++)
        cin >> income[i];

    for( i=0; i< k; i++)
        if( income[i] <0 )
            income[i] = -1*income[i];
        else {
            break;
//            cout<< j<< " ";
        }
//    cout <<endl;
    if( (i+1) %2  ){
        sort(income, income + n);
        income[0]= -1*income[0];
//        cout << income[0]<< endl;
    }

    for(int i=0; i<n; i++)
        resultado+= income[i];

    cout << resultado<< endl;
    return 0;
}


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

int main() {
	int n,k;
	cin>>n>>k;
	vector<int>v(n);
	for(int i=0;i<n;i++)
	cin>>v[i];

	sort(v.begin(),v.end());
	int c=0;
	for(int i=0;i<n;i++)
	{
		if(v[i]<0)
		c++;
		else
		break;
	}

	if(c==0)
	{

		for(int i=0;i<k;i++)
		{
			v[0]*=-1;
		}
	}
	else
	{

		if(k<=c)
		{
			for(int i=0;i<k;i++)
			v[i]*=-1;
		}
		else
		{
			int z=k/c;
			int zx=k%c;

			if(z%2==0)
			{
				zx+=c;
			}
			for(int i=0;i<c;i++)
			{
				v[i]*=-1;
			}
			for(int i=0;i<zx;i++)
			v[c-1]*=-1;
		}

	}
	long sum=0;
	for(int i=0;i<n;i++){
	//	cout<<v[i]<<" ";
	sum+=v[i];
	}
	cout<<sum;

	return 0;
}


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

int main() {
	int n,k;
	cin>>n>>k;
	vector<int>v(n);
	for(int i=0;i<n;i++)
	cin>>v[i];

	sort(v.begin(),v.end());

	for(int i=0;i<k;i++)
	{
		v[i]*=-1;
	}
	long sum=0;
	for(int i=0;i<n;i++)
	{
		sum+=v[i];
	}

	cout<<sum<<endl;

	return 0;
}


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

int main() {
	int n,k;
	cin>>n>>k;
	vector<int>v(n);
	for(int i=0;i<n;i++)
	cin>>v[i];

	sort(v.begin(),v.end());
	int c=0;
	for(int i=0;i<n;i++)
	{
		if(v[i]<=0)
		c++;
		else
		break;
	}

	if(c==0)
	{

		for(int i=0;i<k;i++)
		{
			v[0]*=-1;
		}
	}
	else
	{

		if(k<=c)
		{
			for(int i=0;i<k;i++)
			v[i]*=-1;
		}
		else
		{
			int z=k/c;
			int zx=k%c;

			if(z%2==0)
			{
				zx+=c;
			}
			for(int i=0;i<c;i++)
			{
				v[i]*=-1;
			}
			for(int i=0;i<zx;i++)
			v[c-1]*=-1;
		}

	}
	long sum=0;
	for(int i=0;i<n;i++){
	//	cout<<v[i]<<" ";
	sum+=v[i];
	}
	cout<<sum;

	return 0;
}


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

int main() {
	int n,k;
	cin>>n>>k;
	vector<int>v(n);
	for(int i=0;i<n;i++)
	cin>>v[i];

	sort(v.begin(),v.end());
	int c=0;
	for(int i=0;i<n;i++)
	{
		if(v[i]<=0)
		c++;
		else
		break;
	}

	if(c==0)
	{

		for(int i=0;i<k;i++)
		{
			v[0]*=-1;
		}
	}
	else
	{

		if(k<=c)
		{
			for(int i=0;i<k;i++)
			v[i]*=-1;
		}
		else
		{
			int z=k/c;
			int zx=k%c;

			if(z%2==0)
			{
				zx+=c;
			}
			for(int i=0;i<c;i++)
			{
				v[i]*=-1;
			}
			int minlen=INT_MAX,index;
			for(int i=0;i<n;i++)
			{
				if(v[i]<minlen)
				{
					minlen=v[i];
					index=i;
				}
			}
			for(int i=0;i<zx;i++)
			v[index]*=-1;
		}

	}
	long sum=0;
	for(int i=0;i<n;i++){
	//	cout<<v[i]<<" ";
	sum+=v[i];
	}
	cout<<sum;

	return 0;
}


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

int main() {
	int n,k;
	cin>>n>>k;
	vector<int>v(n);
	for(int i=0;i<n;i++)
	cin>>v[i];

	sort(v.begin(),v.end());
	int j=0;
	int c=0;
	for(int i=0;i<n;i++)
	{
		if(v[i]<0)
		c++;
		else
		break;
	}
	long sum=0;
	if(c==0)
	{
		if(k%2==0)
		{
			for(int i=0;i<n;i++)
			{
				sum+=v[i];
			}
		}
		else
		{
			sum-=v[0];
			for(int i=1;i<n;i++)
			{
				sum+=v[i];
			}
		}
	}
	else
	{
		int z=k%c;
		for(int i=0;i<c;i++)
		v[i]*=-1;
		if(z%2==0)
		{
			for(int i=0;i<n;i++)
			sum+=v[i];
		}
		else
		{
			sum-=v[0];
			for(int i=1;i<n;i++)
			sum+=v[i];
		}

	}

	cout<<sum<<endl;

	return 0;
}


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

int main() {
	int n,k;
	cin>>n>>k;
	vector<int>v(n);
	for(int i=0;i<n;i++)
	cin>>v[i];

	sort(v.begin(),v.end());
	int j=0;
	int c=0;
	for(int i=0;i<n;i++)
	{
		if(v[i]<0)
		c++;
		else
		break;
	}
	long sum=0;
	if(c==0)
	{
		if(k%2==0)
		{
			for(int i=0;i<n;i++)
			{
				sum+=v[i];
			}
		}
		else
		{
			sum-=v[0];
			for(int i=1;i<n;i++)
			{
				sum+=v[i];
			}
		}
	}
	else
	{
		c=min(c,k);
		int z=k%c;

		for(int i=0;i<c;i++)
		v[i]*=-1;
		if(z%2==0)
		{
			for(int i=0;i<n;i++)
			sum+=v[i];
		}
		else
		{
			sum-=v[0];
			for(int i=1;i<n;i++)
			sum+=v[i];
		}

	}

	cout<<sum<<endl;

	return 0;
}


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

int main() {
	int n,k;
	cin>>n>>k;
	vector<int>v(n);
	for(int i=0;i<n;i++)
	cin>>v[i];

	sort(v.begin(),v.end());
	int j=0;
	int c=0;
	for(int i=0;i<n;i++)
	{
		if(v[i]<0)
		c++;
		else
		break;
	}
	long sum=0;
	if(c==0)
	{
		if(k%2==0)
		{
			for(int i=0;i<n;i++)
			{
				sum+=v[i];
			}
		}
		else
		{
			sum-=v[0];
			for(int i=1;i<n;i++)
			{
				sum+=v[i];
			}
		}
	}
	else
	{
		c=min(c,k);
		int z;
		if(k>c)
		{
			z=k-c;
		}
		int num=z;
		while(num > 0)
		{
			num=k-2*c;
		}
		num=k+2*c;
		z=num;
		for(int i=0;i<c;i++)
		v[i]*=-1;
		if(z%2==0)
		{
			for(int i=0;i<n;i++)
			sum+=v[i];
		}
		else
		{
			sum-=v[0];
			for(int i=1;i<n;i++)
			sum+=v[i];
		}

	}

	cout<<sum<<endl;

	return 0;
}


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

int main() {
	int n,k;
	cin>>n>>k;
	vector<int>v(n);
	for(int i=0;i<n;i++)
	cin>>v[i];

	sort(v.begin(),v.end());
	int j=0;
	for(int i=0;i<k;i++)
	{
		v[j]*=-1;
		if(j>=k)
		j=0;
	}
	long sum=0;
	for(int i=0;i<n;i++)
	{
		sum+=v[i];
	}

	cout<<sum<<endl;

	return 0;
}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int n,k;
int arr[10005];

int dp[10005][10005];
int solve(int i,int k)
{
    if(i==n){
        return 1;
    }

    int &ret=dp[i][k];
    if(~ret) return ret;

      ret=arr[i]*solve(i+1,k);
      if(k>0)
        ret=max(ret,-arr[i]*solve(i+1,k-1));

    return ret;

}

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    cin>>n>>k;
    for(int i=0;i<n;i++)cin>>arr[i];
    memset(dp,-1,sizeof dp);
    cout<<solve(0,k)<<endl;

    return 0;
}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int n,k;
int arr[100005];

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    cin>>n>>k;
    for(int i=0;i<n;i++){
        cin>>arr[i];
    }

    for(int i=0;i<n;i++){
        if(arr[i]<0 && k>0)
        {
            k--;
            arr[i]*=-1;
        }
    }
    sort(arr,arr+n); /// if

    for(int i=0;i<n;i++) {
        if(k>0){
            k%=2 ;
            if(k>0){
                arr[0]*=-1;
                k=0;
            }
        }
    }

    cout<<1ll*accumulate(arr,arr+n,0)<<endl;

    return 0;
}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int n,k;
int arr[10005];

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    cin>>n>>k;
    for(int i=0;i<n;i++){
        cin>>arr[i];
    }
    for(int i=0;i<n;i++){
        if(arr[i]<0 && k>0)
        {k--;
        arr[i]*=-1;
        }else {
          if(k>0){
            k%=2 ;
            arr[i]*=-1;
            k=0;
        }
        }
    }

   cout<<1ll*accumulate(arr,arr+n,0)<<endl;

    return 0;
}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int n,k;
int arr[100005];

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    cin>>n>>k;
    for(int i=0;i<n;i++){
        cin>>arr[i];
    }
    for(int i=0;i<n;i++){
        if(arr[i]<0 && k>0)
        {k--;
            arr[i]*=-1;
        }else {
            if(k>0){
                k%=2 ;
                arr[i]*=-1;
                k=0;
            }
        }
    }

    cout<<1ll*accumulate(arr,arr+n,0)<<endl;

    return 0;
}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int n,k;
int arr[10005];

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    cin>>n>>k;
    for(int i=0;i<n;i++){
        cin>>arr[i];
    }
    sort(arr,arr+n);
    for(int i=0;i<n;i++){
        if(arr[i]<0 && k>0)
        {k--;
        arr[i]*=-1;
        }else {
            if (k > 0) {
                k--;
                arr[i] *= -1;
            }
        }
    }

   cout<<1ll*accumulate(arr,arr+n,0)<<endl;

    return 0;
}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int n,k;
int arr[100005];

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    cin>>n>>k;
    for(int i=0;i<n;i++){
        cin>>arr[i];
    }

    for(int i=0;i<n;i++){
        if(arr[i]<0 && k>0)
        {
            k--;
            arr[i]*=-1;

        }else {

            if(k>0){
                sort(arr,arr+n);
                k%=2 ;
                if(k>0){
                arr[0]*=-1;
                k=0;

                }
            }
        }
    }

    cout<<1ll*accumulate(arr,arr+n,0)<<endl;

    return 0;
}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int n,k;
int arr[100005];

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    cin>>n>>k;
    for(int i=0;i<n;i++){
        cin>>arr[i];
    }
    if(n==1 && arr[0]< 0){
        if(k%2==0){
            cout<<arr[0]<<endl;
            return 0;
        }else{
            cout<<-arr[0]<<endl;
            return 0;
        }
    }
    for(int i=0;i<n;i++){
        if(arr[i]<0 && k>0)
        {k--;
            arr[i]*=-1;
        }else {
            if(k>0){
                k%=2 ;
                if(k>0){
                arr[i]*=-1;
                k=0;}
            }
        }
    }

    cout<<1ll*accumulate(arr,arr+n,0)<<endl;

    return 0;
}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int n,k;
int arr[100005];

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    cin>>n>>k;
    int o=-1;
    for(int i=0;i<n;i++){
        cin>>arr[i];
        if(arr[i]<0)o=i;
    }
    for(int i=o;i>=0;i--){
        if(k>0){
        k--;
        arr[i]*=-1;
    }
    }

    for(int i=o+1;i<n;i++){
            if(k>0){
                k%=2 ;
                arr[i]*=-1;
                k=0;
            }
        }

    cout<<1ll*accumulate(arr,arr+n,0)<<endl;

    return 0;
}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int n,k;
int arr[10005];

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    cin>>n>>k;
    int o=0;
    for(int i=0;i<n;i++){
        cin>>arr[i];
        if(arr[i]<0)o=i;
    }
    for(int i=o;i>=0;i--){
        if(k>0){
        k--;
        arr[i]*=-1;
    }
    }

    for(int i=o+1;i<n;i++){
            if(k>0){
                k%=2 ;
                arr[i]*=-1;
                k=0;
            }
        }

    cout<<1ll*accumulate(arr,arr+n,0)<<endl;

    return 0;
}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int n,k;
vector<int>arr,arr2;

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    cin>>n>>k;
    for(int i=0;i<n;i++){
        int a;cin>>a;
        if(a<0)
        arr2.push_back(a);
        else
            arr.push_back(a);

    }
    sort(arr2.begin(),arr2.end(),greater<int>());

    for(int i=0;i<n;i++){
        if(arr[i]<0 && k>0)
        {
            k--;
        arr[i]*=-1;

        }else {
          if(k>0){
            k%=2 ;
            arr[i]*=-1;
            k=0;
        }
        }
    }

   cout<<1ll*accumulate(arr.begin(),arr.end(),0)+1ll*accumulate(arr2.begin(),arr2.end(),0)<<endl;

    return 0;
}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int n,k;
int arr[100005];

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    cin>>n>>k;
    for(int i=0;i<n;i++){
        cin>>arr[i];
    }
    for(int i=0;i<n;i++){
        if(arr[i]<0 && k>0)
        {k--;
            arr[i]*=-1;
        }else {
            if(k>0){
                k%=2 ;
                if(k>0){
                arr[i]*=-1;
                k=0;}
            }
        }
    }

    cout<<1ll*accumulate(arr,arr+n,0)<<endl;

    return 0;
}


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

int main() {
	// your code goes here

	int n, k, a[10001], i = 1;
	cin >> n >> k;

	for(int i = 1; i <= n; ++i) cin >> a[i];

	long sum = 0;
	int mx = a[n], minus = 0;

	while(i <= n){

	    if(abs(a[i]) >= mx){

	        if(a[i] < 0 && k > 0) a[i] *= -1, --k, ++i, minus= 1;
	        else break;
	    }
	    else break;
	}

	if(k > 0 && minus == 0){

	    if(k % 2) a[1] *= -1;
	    k = 0;
	}

	for(int i = 1; i <= n; ++i){

	    if(a[i] < 0 && k > 0) a[i] *= -1, --k;
	    sum += a[i];
	}

	cout << sum <<"\n";

	return 0;
}


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

int main() {
	// your code goes here

	int n, k, a[100001], i = 1;
	cin >> n >> k;

	for(int i = 1; i <= n; ++i) cin >> a[i];

	long sum = 0;
	int mx = a[n], minus = 0;

	while(i <= n){

	    if(abs(a[i]) >= mx){

	        if(a[i] < 0 && k > 0) a[i] *= -1, --k, ++i, minus= 1;
	        else break;
	    }
	    else {a[i] < 0 ? minus = 1 : minus = 0;break;}
	}

	if(k > 0 && minus == 0){

	    if(k % 2) a[1] *= -1;
	    k = 0;
	}

	for(int i = 1; i <= n; ++i){

	    if(a[i] < 0 && k > 0) a[i] *= -1, --k;
	    sum += a[i];
	}

	cout << sum <<"\n";

	return 0;
}


→ Source
Copy

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

int main() {
	// your code goes here

	int n, k, a[10001], i = 1;
	cin >> n >> k;

	for(int i = 1; i <= n; ++i) cin >> a[i];

	long sum = 0;
	int mx = a[n], minus = 0;

	while(i <= n){

	    if(abs(a[i]) >= mx){

	        if(a[i] < 0 && k > 0) a[i] *= -1, --k, ++i, minus= 1;
	        else break;
	    }
	    else {a[i] < 0 ? minus = 1 : minus = 0;break;}
	}

	if(k > 0 && minus == 0){

	    if(k % 2) a[1] *= -1;
	    k = 0;
	}

	for(int i = 1; i <= n; ++i){

	    if(a[i] < 0 && k > 0) a[i] *= -1, --k;
	    sum += a[i];
	}

	cout << sum <<"\n";

	return 0;
}


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

int main() {
	// your code goes here

	int n, k, a[10001], i = 1;
	cin >> n >> k;

	for(int i = 1; i <= n; ++i) cin >> a[i];

	long sum = 0;
	int mx = a[n], minus = 0;

	while(i <= n){

	    if(abs(a[i]) >= mx){

	        if(a[i] < 0 && k > 0) a[i] *= -1, --k, ++i, minus= 1;
	        else break;
	    }
	    else {a[i] < 0 ? minus = 1 : minus = 0;break;}
	}

	if(k > 0 && minus == 0){

	    if(k % 2) a[1] *= -1;
	    k = 0;
	}

	for(int i = 1; i <= n; ++i){

	    if(a[i] < 0 && k > 0) a[i] *= -1, --k;
	    sum += a[i];
	}

	cout << sum <<"\n";

	return 0;
}


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

int main() {
	// your code goes here

	int n, k, a[100001], i = 1;
	cin >> n >> k;

	for(int i = 1; i <= n; ++i) cin >> a[i];

	long sum = 0;
	int mx = a[n], minus = 0;

	while(i <= n){

	    if(abs(a[i]) >= mx){

	        if(a[i] < 0 && k > 0) a[i] *= -1, --k, ++i, minus= 1;
	        else break;
	    }
	    else {
	        if(minus == 0){
	            if(a[i] < 0) minus = 1;
	        }
	    }

	    }
	}

	if(k > 0 && minus == 0){

	    if(k % 2) a[1] *= -1;
	    k = 0;
	}

	for(int i = 1; i <= n; ++i){

	    if(a[i] < 0 && k > 0) a[i] *= -1, --k;
	    sum += a[i];
	}

	cout << sum <<"\n";

	return 0;
}


#include<bits/stdc++.h>
typedef long long int ll;

#define dbg printf("in\n");
#define nl printf("\n");
#define pp pair<ll,ll>

using namespace std;

int main()
{
    //freopen("in.txt","r",stdin);

    ll i,j,k;
    ll n,x;

    cin>>n>>k;

    ll a[n];
    for(i=0;i<n;i++)
        cin>>a[i];

    for(i=0;i<n,k>0;i++)
    {
        if(a[i]<0)
            a[i]*=-1,k--;
        else
            break;
    }

    sort(a,a+n);

    if(k>0)
    {
        if(k%2)
            a[0]*=-1;
    }

    ll count=0;
    for(i=0;i<n;i++)
        count+=a[i];

    cout<<count;

    return 0;
}


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

int main() {
	// your code goes here

	int n, k, a[100001], i = 1;
	cin >> n >> k;

	for(int i = 1; i <= n; ++i) cin >> a[i];

	long sum = 0;
	int mx = a[n], minus = 0;

	while(i <= n){

	    if(abs(a[i]) >= mx){

	        if(a[i] < 0 && k > 0) a[i] *= -1, --k, ++i, minus= 1;
	        else break;
	    }
	    else {

	        if(minus == 0){
	            if(a[i] < 0) minus = 1;
	        }
	        break;
	    }
	}

	if(k > 0 && minus == 0){

	    if(k % 2) a[1] *= -1;
	    k = 0;
	}

	for(int i = 1; i <= n; ++i){

	    if(a[i] < 0 && k > 0) a[i] *= -1, --k;
	    sum += a[i];
	}

	cout << sum <<"\n";

	return 0;
}


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

int main() {
	// your code goes here

	int n, k, a[10001], i = 1;
	cin >> n >> k;

	for(int i = 1; i <= n; ++i) cin >> a[i];

	long sum = 0;
	int mx = a[n], minus = 0;

	while(i <= n){

	    if(abs(a[i]) >= mx){

	        if(a[i] < 0 && k > 0) a[i] *= -1, --k, ++i, minus= 1;
	        else break;
	    }
	    else break;
	}

	if(k > 0 && minus == 0){

	    if(k % 2) a[1] *= -1;
	}

	for(int i = 1; i <= n; ++i){

	    if(a[i] < 0 && k > 0) a[i] *= -1, --k;
	    sum += a[i];
	}

	cout << sum <<"\n";

	return 0;
}


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

int main() {
	// your code goes here

	int n, k, a[10001], i = 1;
	cin >> n >> k;

	for(int i = 1; i <= n; ++i) cin >> a[i];

	long sum = 0;
	int mx = a[n];

	while(i <= n){

	    if(abs(a[i]) >= mx){

	        if(a[i] < 0 && k > 0) a[i] *= -1, --k, ++i;
	        else break;
	    }
	    else break;
	}

	for(int i = 1; i <= n; ++i){

	    if(a[i] < 0 && k > 0) a[i] *= -1, --k;
	    sum += a[i];
	}

	cout << sum <<"\n";

	return 0;
}


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

int main() {
	// your code goes here

	int n, k, a[100001], i = 1;
	cin >> n >> k;

	for(int i = 1; i <= n; ++i) cin >> a[i];

	long sum = 0;
	int mx = a[n], minus = 0;

	while(i <= n){

	    if(abs(a[i]) >= mx){

	        if(a[i] < 0 && k > 0) a[i] *= -1, --k, ++i, minus= 1;
	        else break;
	    }
	    else {a[i] < 0 && minus == 0 ? minus = 1 : minus = 0;break;}
	}

	if(k > 0 && minus == 0){

	    if(k % 2) a[1] *= -1;
	    k = 0;
	}

	for(int i = 1; i <= n; ++i){

	    if(a[i] < 0 && k > 0) a[i] *= -1, --k;
	    sum += a[i];
	}

	cout << sum <<"\n";

	return 0;
}


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

#define ICPC
#define ll long long
#define lld long long double
#define ull unsigned long long
#define sz(v)   ((int)((v).size()))
#define all(v) ((v).begin()), ((v).end())
#define forr(c,x,n)  for(int c=x;c<=n; ++c)
#define forrr(c,x,n)  for(int c=x;c >= n ; --c)
#define SPEED ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);

int main()
{
    int n , k  , vec[100007];

	cin >> n >> k;
	for (int i = 0; i < n; i++)	cin >> vec[i];

	sort(vec, vec + n);
	int b = 0;
	while (b < n && k--)
	{
		if (vec[b] >= 0)
        {
			k++;
			break;
		}
		vec[b++] *= -1;
	}
	sort(vec, vec + n);

    ll sum = 0;
    for (int i = 0; i < n; i++)	sum += vec[i];

	if (vec[0] != 0 && k % 2 != 0) sum-= vec[0]*2;

	printf("%lld" , sum);

}


#include <bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define sortv(v) sort(v.begin(),v.end());
#define all(v) ((v).begin()), ((v).end())
#define sz(v)   ((int)((v).size()))
#define el  "\n"
#define forr(i,n)  for(long long i=0;i<n;i++)
#define fo(i,n)  for(long long i=n-1;i>=0;i--)
#define wt while(true)
#define pi 3.14159265359
#define siz 1000007
#define mod 1000000007
#define ICPC
using namespace std;

int main()
{
ll n , k  , zero = 0 , neg =0  , sum =0;   cin>>n>>k;
ll *a=new ll[n];

forr(i,n)
{cin>>a[i]; if ( a[i]==0) zero =1 ;  if ( a[i]<0) neg++; }

sort(a,a+n);
if ( k <= neg )
{for ( int i = 0 ; i<n ; i++)
if ( i < k)
sum+=a[i]*-1;
else
sum+=a[i];
}
else
{
    if (zero==1 || (k-neg)%2==0)
    {for ( int i = 0 ; i<n ; i++)
if ( i < neg)
sum+=a[i]*-1;
else
sum+=a[i];
cout<<sum<<" ";
    }
    else
    {

        for ( int i = 0 ; i < n ; i++ )
            if ( i <neg)
            sum+=a[i]*-1;
        else
            sum+=a[i];

        if ( a[neg-1]< a[neg])
            sum -= 2*a[neg-1];
        else
            sum-=2*a[neg];
    }

}
cout<<sum;

    return 0;
}


#include <bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define sortv(v) sort(v.begin(),v.end());
#define all(v) ((v).begin()), ((v).end())
#define sz(v)   ((int)((v).size()))
#define el  "\n"
#define forr(i,n)  for(long long i=0;i<n;i++)
#define fo(i,n)  for(long long i=n-1;i>=0;i--)
#define wt while(true)
#define pi 3.14159265359
#define siz 1000007
#define mod 1000000007
#define ICPC
using namespace std;

int main()
{
ll n , k  , zero = 0 , neg =0  , sum =0;   cin>>n>>k;
ll *a=new ll[n];

forr(i,n)
{cin>>a[i]; if ( a[i]==0) zero =1 ;  if ( a[i]<0) neg++; }

sort(a,a+n);
if ( k <= neg )
{for ( int i = 0 ; i<n ; i++)
if ( i < k)
sum+=a[i]*-1;
else
sum+=a[i];
}
else
{
    if (zero==1 || (k-neg)%2==0)
    {for ( int i = 0 ; i<n ; i++)
if ( i < neg)
sum+=a[i]*-1;
else
sum+=a[i];

    }
    else
    {

        for ( int i = 0 ; i < n ; i++ )
            if ( i <neg)
            sum+=a[i]*-1;
        else
            sum+=a[i];

        if ( a[neg-1]< a[neg])
            sum -= 2*a[neg-1];
        else
            sum-=2*a[neg];
    }

}
cout<<sum;

    return 0;
}


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

#define ICPC
#define ll long long
#define lld long long double
#define ull unsigned long long
#define sz(v)   ((int)((v).size()))
#define all(v) ((v).begin()), ((v).end())
#define forr(c,x,n)  for(int c=x;c<=n; ++c)
#define forrr(c,x,n)  for(int c=x;c >= n ; --c)
#define SPEED ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);

int main()
{
    int n , k  , vec[100007];

	cin >> n >> k;
	for (int i = 0; i < n; i++)	cin >> vec[i];

	sort(vec, vec + n);
	int b = 0;
	while (b < n && k--)
	{
		if (vec[b] >= 0)
        {
			k++;
			break;
		}
		vec[b++] *= -1;
	}
	if ( k < 0 ) k=0;
	sort(vec, vec + n);

    ll sum = 0;
    for (int i = 0; i < n; i++)	sum += vec[i];

	if (vec[0] != 0 && k % 2 != 0) sum-= vec[0]*2;

	printf("%lld" , sum);

}


#include <bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define sortv(v) sort(v.begin(),v.end());
#define all(v) ((v).begin()), ((v).end())
#define sz(v)   ((int)((v).size()))
#define el  "\n"
#define forr(i,n)  for(long long i=0;i<n;i++)
#define fo(i,n)  for(long long i=n-1;i>=0;i--)
#define wt while(true)
#define pi 3.14159265359
#define siz 1000007
#define mod 1000000007
#define ICPC
using namespace std;

int main()
{
ll n , k  , zero = 0 , neg =0  , sum =0, min ; cin>>n>>k;
ll *a=new ll[n];

forr(i,n)
{cin>>a[i]; if ( a[i]==0) zero =1 ;  if ( a[i]<0) neg++; }

sort(a,a+n);
if ( k <= neg )
{for ( int i = 0 ; i<n ; i++)
if ( i < k)
sum+=a[i]*-1;
else
sum+=a[i];
}
else
{
    if (zero==1 || (k-neg)%2==0)
    {for ( int i = 0 ; i<n ; i++)
if ( i < neg)
sum+=a[i]*-1;
else
sum+=a[i];

    }
    else
    {

        for ( int i = 0 ; i < n ; i++ )
            {if ( i <neg)
            sum+=a[i]*-1;
        else
            sum+=a[i];

            if ( abs(a[i])<min ) min =abs(a[i]);

            }

        sum-=2*min;
    }

}
cout<<sum;

    return 0;
}


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

#define ICPC
#define ll long long
#define lld long long double
#define ull unsigned long long
#define sz(v)   ((int)((v).size()))
#define all(v) ((v).begin()), ((v).end())
#define forr(c,x,n)  for(int c=x;c<=n; ++c)
#define forrr(c,x,n)  for(int c=x;c >= n ; --c)
#define SPEED ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);

int main()
{

int n , k , z =1 , neg = 0 , mini = 1e9 , suma = 0  , sumb= 0  ;
cin >> n >> k ;
int a[100007];

forr ( i , 0 , n -1 )
{
    cin >> a[i];
    if ( a[i] < 0 )
    {
        neg++;
        sumb+=a[i];
    }
    else
        suma+=a[i];

    mini = min ( abs (a[i]) , mini );
}
if ( neg == k )
    cout << suma + sumb * -1;
else if ( k < neg  )
{
    sort (a,a+n);
    forr ( i , 0 , n -1  )
    {
        if ( k )
        {
           sumb += 2 * (a[i] * -1) ;
           k--;
        }
        if ( !k )
            break;
    }
    cout << suma + sumb ;
}
else
{
    k -= neg ;
    if ( k % 2 == 0 )
    cout << suma + sumb * -1;
    else
    cout << suma + sumb * -1 - mini ;
}

}


#include <bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define sortv(v) sort(v.begin(),v.end());
#define all(v) ((v).begin()), ((v).end())
#define sz(v)   ((int)((v).size()))
#define el  "\n"
#define forr(i,n)  for(long long i=0;i<n;i++)
#define fo(i,n)  for(long long i=n-1;i>=0;i--)
#define wt while(true)
#define pi 3.14159265359
#define siz 1000007
#define mod 1000000007
#define ICPC
using namespace std;

int main()
{
int n , k  , zero = 0 , neg =0  , sum =0;   cin>>n>>k;
int *a=new int[n];

forr(i,n)
{cin>>a[i]; if ( a[i]==0) zero =1 ;  if ( a[i]<0) neg++; }

sort(a,a+n);
if ( k <= neg )
{for ( int i = 0 ; i<n ; i++)
if ( i < k)
sum+=a[i]*-1;
else
sum+=a[i];
}
else
{
    if (zero==1 || k-neg%2==0)
    {for ( int i = 0 ; i<n ; i++)
if ( i < neg)
sum+=a[i]*-1;
else
sum+=a[i];
    }
    else
    {

        for ( int i = 0 ; i < n ; i++ )
            if ( i <neg)
            sum+=a[i]*-1;
        else
            sum+=a[i];

        if ( a[neg-1]< a[neg])
            sum -= 2*a[neg-1];
        else
            sum-=2*a[neg];
    }

}
cout<<sum;

    return 0;
}


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

#define ICPC
#define ll long long
#define lld long long double
#define ull unsigned long long
#define sz(v)   ((int)((v).size()))
#define all(v) ((v).begin()), ((v).end())
#define forr(c,x,n)  for(int c=x;c<=n; ++c)
#define forrr(c,x,n)  for(int c=x;c >= n ; --c)
#define SPEED ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);

int main()
{
int p  = 0 , n = 0  , x , k ;

cin >> x >> k ;

forr( i , 0 , x-1)
{
    int h; cin >> h ;

    if ( h < 0 ) n++; else p++;

}
if ( k >= n )
{
    k-=n;
    p+=n;
    if ( k% 2 != 0 ) p--;
}
else
{
    p+=k;
    p-= (n - k );
}

cout << p ;
}


#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <list>
#include <map>
#include <algorithm>
#include <math.h>
#include <iomanip>

using namespace std ;

bool compare ( pair<long long , int > p1 , pair<long long , int > p2 )
{
	return ( p1.second > p2.second ) ;
}

int f[200000],s[200000];
long long a[10000001] ;
//int ar[1000000];
	int ar[200] ;
/*
void solve(int i ,vector<vector<int>> &inputs)
{
	ar[i]-- ;
	inputs[i].clear() ;
	int x = inputs[i].front() ;

	//vector<int> ::iterator it = find(inputs[x].begin(), inputs[x].end(),i ) ;
//	inputs[x].erase(std::remove(inputs[x].begin(), inputs[x].end(), i ) , inputs[x].end() ) ;
	//it = inputs[x].erase(it) ;
}	*/

int main()
{
	ios::sync_with_stdio(0);cin.tie(0);ios_base::sync_with_stdio(0);

	/*int X[51][2] , Y[51][2];
	int p , q , l , r , a , b , c ,d ;

	cin >> p >> q >> l >> r ;
	for ( int i = 0 ; i < p ; i++ )
		cin >> X[i][2] ;
	for ( int i = 0 ; i < q ; i++ )
		cin >> Y[i][2] ;

	for ( int i = 0 ; i < q ; i++ )
	{
		for ( int j = l ; j <= r ; j++ )
		{
			if ( Y[0][0] + j && Y[0][1] + j > X[0][0] = X[0][1]
		}

	}*/

	int n , k ;

	cin >> n >> k ;
	vector<int> v(n) ;

	int negatives = 0 ;

	for ( int i = 0 ;i < n ; i++ )
	{
		cin >> v[i] ;
		if ( v[i] < 0 )
			negatives++ ;
	}
	/*

	if ( negatives >= k )
	{
		for ( int i = 0 ; i < n ; i++ )
		{
			if ( k == 0 )
				break;
			if ( v[i] < 0 )
			{
				v[i] = v[i]*-1 ;
			}
			k-- ;
		}
	}
	else
	{
		int index = -1 ;
		bool flag = false ;
		for ( int i = 0 ; i < n-1 ; i++ )
		{
			k-- ;
			if ( v[i] < 0 && v[i+1] < 0 )
			{
				v[i] = v[i]*-1 ;
				//k-- ;
			}
			else
				flag = 1 ;

			if (flag)
			{
				v[i] = v[i] *-1 ;
				flag = 0 ;
				index = i+1 ;
				break ;
				//k-- ;
			}
		}
		if ( k % 2 != 0 )
		{

			v[index] = v[index] * -1 ;
		}
	}
	*/

	long long min = 999999 ;
	int indmin = -1  ;
	bool fof = false , an = false ;
	int index = -1 ;
	for ( int i = 0 ;i < n ;i++ )
	{
		if ( k == 0 )
			break ;

		if ( v[i] < 0 ) {
			v[i] = v[i] * -1 ;
			k-- ;
			if ( v[i] < min )
			{
				min = v[i] ;
				indmin = i ;
			}
			//continue ;
		}
		else
		{
			index = i ;
			fof = 1 ;
			an = 1 ;
			break ;
		}

	}

	if ( k > 0 )
	{
		if ( !an )
		{
			if ( k % 2 != 0 )
			{
				v[n-1] = v[n-1] * -1 ;
			}
		}

		if ( fof == 1 && negatives == 0 )
		{
			if ( k % 2 != 0 )
			{
				v[indmin] = v[indmin] * -1 ;
			}
		}
		else if ( fof == 1 && negatives != 0 )
		{
			if ( k % 2 != 0 )
			{
				v[indmin] = v[indmin] * -1 ;
			}
		}
	}

	long long sum = 0 ;
	for ( int i = 0 ;i < n ; i++ )
		sum += v[i] ;

	cout << sum << endl;

	return 0;
}


#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <list>
#include <map>
#include <algorithm>
#include <math.h>
#include <iomanip>

using namespace std ;

bool compare ( pair<long long , int > p1 , pair<long long , int > p2 )
{
	return ( p1.second > p2.second ) ;
}

int f[200000],s[200000];
long long a[10000001] ;
//int ar[1000000];
	int ar[200] ;
/*
void solve(int i ,vector<vector<int>> &inputs)
{
	ar[i]-- ;
	inputs[i].clear() ;
	int x = inputs[i].front() ;

	//vector<int> ::iterator it = find(inputs[x].begin(), inputs[x].end(),i ) ;
//	inputs[x].erase(std::remove(inputs[x].begin(), inputs[x].end(), i ) , inputs[x].end() ) ;
	//it = inputs[x].erase(it) ;
}	*/

int main()
{
	ios::sync_with_stdio(0);cin.tie(0);ios_base::sync_with_stdio(0);

	/*int X[51][2] , Y[51][2];
	int p , q , l , r , a , b , c ,d ;

	cin >> p >> q >> l >> r ;
	for ( int i = 0 ; i < p ; i++ )
		cin >> X[i][2] ;
	for ( int i = 0 ; i < q ; i++ )
		cin >> Y[i][2] ;

	for ( int i = 0 ; i < q ; i++ )
	{
		for ( int j = l ; j <= r ; j++ )
		{
			if ( Y[0][0] + j && Y[0][1] + j > X[0][0] = X[0][1]
		}

	}*/

	int n , k ;

	cin >> n >> k ;
	vector<int> v(n) ;

	int negatives = 0 ;

	for ( int i = 0 ;i < n ; i++ )
	{
		cin >> v[i] ;
		if ( v[i] < 0 )
			negatives++ ;
	}
	/*

	if ( negatives >= k )
	{
		for ( int i = 0 ; i < n ; i++ )
		{
			if ( k == 0 )
				break;
			if ( v[i] < 0 )
			{
				v[i] = v[i]*-1 ;
			}
			k-- ;
		}
	}
	else
	{
		int index = -1 ;
		bool flag = false ;
		for ( int i = 0 ; i < n-1 ; i++ )
		{
			k-- ;
			if ( v[i] < 0 && v[i+1] < 0 )
			{
				v[i] = v[i]*-1 ;
				//k-- ;
			}
			else
				flag = 1 ;

			if (flag)
			{
				v[i] = v[i] *-1 ;
				flag = 0 ;
				index = i+1 ;
				break ;
				//k-- ;
			}
		}
		if ( k % 2 != 0 )
		{

			v[index] = v[index] * -1 ;
		}
	}
	*/

	bool fof = false , an = false ;
	int index = -1 ;
	for ( int i = 0 ;i < n ;i++ )
	{
		if ( k == 0 )
			break ;

		if ( v[i] < 0 ) {
			v[i] = v[i] * -1 ;
			k-- ;
			//continue ;
		}
		else
		{
			index = i ;
			fof = 1 ;
			break ;
		}

		if ( fof == 0 && k > 0 )
		{
			an = 1 ;
		}

	}

	if ( k > 0 )
	{
		if ( an )
		{
			v[n-1] *= -1 ;
		}

		if ( fof == 1 && negatives == 0 )
		{
			if ( k % 2 != 0 )
			{
				v[index] = v[index] * -1 ;
			}
		}
		else if ( fof == 1 && negatives != 0 )
		{
			if ( k % 2 != 0 )
			{
				v[index] = v[index] * -1 ;
			}
		}
	}

	long long sum = 0 ;
	for ( int i = 0 ;i < n ; i++ )
		sum += v[i] ;

	cout << sum << endl;

	return 0;
}


#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <list>
#include <map>
#include <algorithm>
#include <math.h>
#include <iomanip>

using namespace std ;

bool compare ( pair<long long , int > p1 , pair<long long , int > p2 )
{
	return ( p1.second > p2.second ) ;
}

int f[200000],s[200000];
long long a[10000001] ;
//int ar[1000000];
	int ar[200] ;
/*
void solve(int i ,vector<vector<int>> &inputs)
{
	ar[i]-- ;
	inputs[i].clear() ;
	int x = inputs[i].front() ;

	//vector<int> ::iterator it = find(inputs[x].begin(), inputs[x].end(),i ) ;
//	inputs[x].erase(std::remove(inputs[x].begin(), inputs[x].end(), i ) , inputs[x].end() ) ;
	//it = inputs[x].erase(it) ;
}	*/

int main()
{
	ios::sync_with_stdio(0);cin.tie(0);ios_base::sync_with_stdio(0);

	/*int X[51][2] , Y[51][2];
	int p , q , l , r , a , b , c ,d ;

	cin >> p >> q >> l >> r ;
	for ( int i = 0 ; i < p ; i++ )
		cin >> X[i][2] ;
	for ( int i = 0 ; i < q ; i++ )
		cin >> Y[i][2] ;

	for ( int i = 0 ; i < q ; i++ )
	{
		for ( int j = l ; j <= r ; j++ )
		{
			if ( Y[0][0] + j && Y[0][1] + j > X[0][0] = X[0][1]
		}

	}*/

	int n , k ;

	cin >> n >> k ;
	vector<int> v(n) ;

	int negatives = 0 ;

	for ( int i = 0 ;i < n ; i++ )
	{
		cin >> v[i] ;
		if ( v[i] < 0 )
			negatives++ ;
	}
	/*

	if ( negatives >= k )
	{
		for ( int i = 0 ; i < n ; i++ )
		{
			if ( k == 0 )
				break;
			if ( v[i] < 0 )
			{
				v[i] = v[i]*-1 ;
			}
			k-- ;
		}
	}
	else
	{
		int index = -1 ;
		bool flag = false ;
		for ( int i = 0 ; i < n-1 ; i++ )
		{
			k-- ;
			if ( v[i] < 0 && v[i+1] < 0 )
			{
				v[i] = v[i]*-1 ;
				//k-- ;
			}
			else
				flag = 1 ;

			if (flag)
			{
				v[i] = v[i] *-1 ;
				flag = 0 ;
				index = i+1 ;
				break ;
				//k-- ;
			}
		}
		if ( k % 2 != 0 )
		{

			v[index] = v[index] * -1 ;
		}
	}
	*/

	bool fof = false ;
	int index = -1 ;
	for ( int i = 0 ;i < n ;i++ )
	{
		if ( k == 0 )
			break ;

		if ( v[i] < 0 ) {
			v[i] = v[i] * -1 ;
			k-- ;
		}
		else
		{
			index = i ;
			fof = 1 ;
			break ;
		}
	}

	if ( fof == 1 && negatives == 0 )
	{
		if ( k % 2 != 0 )
		{
			v[index] = v[index] * -1 ;
		}
	}
	else if ( fof == 1 && negatives != 0 )
	{
		if ( k % 2 != 0 )
		{
			v[index] = v[index] * -1 ;
		}
	}

	long long sum = 0 ;
	for ( int i = 0 ;i < n ; i++ )
		sum += v[i] ;

	cout << sum << endl;

	return 0;
}


#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <list>
#include <map>
#include <algorithm>
#include <math.h>
#include <iomanip>

using namespace std ;

bool compare ( pair<long long , int > p1 , pair<long long , int > p2 )
{
	return ( p1.second > p2.second ) ;
}

int f[200000],s[200000];
long long a[10000001] ;
//int ar[1000000];
	int ar[200] ;
/*
void solve(int i ,vector<vector<int>> &inputs)
{
	ar[i]-- ;
	inputs[i].clear() ;
	int x = inputs[i].front() ;

	//vector<int> ::iterator it = find(inputs[x].begin(), inputs[x].end(),i ) ;
//	inputs[x].erase(std::remove(inputs[x].begin(), inputs[x].end(), i ) , inputs[x].end() ) ;
	//it = inputs[x].erase(it) ;
}	*/

int main()
{
	ios::sync_with_stdio(0);cin.tie(0);ios_base::sync_with_stdio(0);

	/*int X[51][2] , Y[51][2];
	int p , q , l , r , a , b , c ,d ;

	cin >> p >> q >> l >> r ;
	for ( int i = 0 ; i < p ; i++ )
		cin >> X[i][2] ;
	for ( int i = 0 ; i < q ; i++ )
		cin >> Y[i][2] ;

	for ( int i = 0 ; i < q ; i++ )
	{
		for ( int j = l ; j <= r ; j++ )
		{
			if ( Y[0][0] + j && Y[0][1] + j > X[0][0] = X[0][1]
		}

	}*/

	int n , k ;

	cin >> n >> k ;
	vector<int> v(n) ;

	for ( int i = 0 ;i < n ; i++ )
		cin >> v[i] ;

	for ( int i = 0 ;i < n ; i++ )
	{
		if ( k == 0 )
			break;
		if ( v[i] < 0 )
		{
			v[i] = v[i]*-1 ;
		}
		k-- ;

	}

	long long sum = 0 ;

	for ( int i = 0 ;i < n ; i++ )
		sum += v[i] ;

	cout << sum << endl;

	return 0;
}


#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <list>
#include <map>
#include <algorithm>
#include <math.h>
#include <iomanip>

using namespace std ;

bool compare ( pair<long long , int > p1 , pair<long long , int > p2 )
{
	return ( p1.second > p2.second ) ;
}

int f[200000],s[200000];
long long a[10000001] ;
//int ar[1000000];
	int ar[200] ;
/*
void solve(int i ,vector<vector<int>> &inputs)
{
	ar[i]-- ;
	inputs[i].clear() ;
	int x = inputs[i].front() ;

	//vector<int> ::iterator it = find(inputs[x].begin(), inputs[x].end(),i ) ;
//	inputs[x].erase(std::remove(inputs[x].begin(), inputs[x].end(), i ) , inputs[x].end() ) ;
	//it = inputs[x].erase(it) ;
}	*/

int main()
{
	ios::sync_with_stdio(0);cin.tie(0);ios_base::sync_with_stdio(0);

	/*int X[51][2] , Y[51][2];
	int p , q , l , r , a , b , c ,d ;

	cin >> p >> q >> l >> r ;
	for ( int i = 0 ; i < p ; i++ )
		cin >> X[i][2] ;
	for ( int i = 0 ; i < q ; i++ )
		cin >> Y[i][2] ;

	for ( int i = 0 ; i < q ; i++ )
	{
		for ( int j = l ; j <= r ; j++ )
		{
			if ( Y[0][0] + j && Y[0][1] + j > X[0][0] = X[0][1]
		}

	}*/

	int n , k ;

	cin >> n >> k ;
	vector<int> v(n) ;

	int negatives = 0 ;

	for ( int i = 0 ;i < n ; i++ )
	{
		cin >> v[i] ;
		if ( v[i] < 0 )
			negatives++ ;
	}

	if ( negatives >= k )
	{
		for ( int i = 0 ; i < n ; i++ )
		{
			if ( k == 0 )
				break;
			if ( v[i] < 0 )
			{
				v[i] = v[i]*-1 ;
			}
			k-- ;
		}
	}
	else
	{
		int index = -1 ;
		bool flag = false ;
		for ( int i = 0 ; i < n-1 ; i++ )
		{
			k-- ;
			if ( v[i] < 0 && v[i+1] < 0 )
			{
				v[i] = v[i]*-1 ;
				//k-- ;
			}
			else
				flag = 1 ;

			if (flag)
			{
				v[i] = v[i] *-1 ;
				flag = 0 ;
				index = i+1 ;
				break ;
				//k-- ;
			}
		}
		if ( k % 2 != 0 )
		{
			/*for ( int i = index ; i < n ; i++ )
			{

			}*/
			v[index] = v[index] * -1 ;
		}
	}

	long long sum = 0 ;
	for ( int i = 0 ;i < n ; i++ )
		sum += v[i] ;

	cout << sum << endl;

	return 0;
}


#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <list>
#include <map>
#include <algorithm>
#include <math.h>
#include <iomanip>

using namespace std ;

bool compare ( pair<long long , int > p1 , pair<long long , int > p2 )
{
	return ( p1.second > p2.second ) ;
}

int f[200000],s[200000];
long long a[10000001] ;
//int ar[1000000];
	int ar[200] ;
/*
void solve(int i ,vector<vector<int>> &inputs)
{
	ar[i]-- ;
	inputs[i].clear() ;
	int x = inputs[i].front() ;

	//vector<int> ::iterator it = find(inputs[x].begin(), inputs[x].end(),i ) ;
//	inputs[x].erase(std::remove(inputs[x].begin(), inputs[x].end(), i ) , inputs[x].end() ) ;
	//it = inputs[x].erase(it) ;
}	*/

int main()
{
	ios::sync_with_stdio(0);cin.tie(0);ios_base::sync_with_stdio(0);

	/*int X[51][2] , Y[51][2];
	int p , q , l , r , a , b , c ,d ;

	cin >> p >> q >> l >> r ;
	for ( int i = 0 ; i < p ; i++ )
		cin >> X[i][2] ;
	for ( int i = 0 ; i < q ; i++ )
		cin >> Y[i][2] ;

	for ( int i = 0 ; i < q ; i++ )
	{
		for ( int j = l ; j <= r ; j++ )
		{
			if ( Y[0][0] + j && Y[0][1] + j > X[0][0] = X[0][1]
		}

	}*/

	int n , k ;

	cin >> n >> k ;
	vector<int> v(n) ;

	int negatives = 0 ;

	for ( int i = 0 ;i < n ; i++ )
	{
		cin >> v[i] ;
		if ( v[i] < 0 )
			negatives++ ;
	}

	if ( negatives >= k )
	{
		int i = 0 ;
		while (k--)
		{
			v[i]*=-1 ;
			i++ ;
		}
	}
	else if ( k > negatives )
	{
		for ( int i = 0 ;i < n ; i++ )
		{
			if ( v[i] < 0 )
			{
				v[i] *= -1 ;
				k-- ;
			}
			else
				break;
		}

		if ( k > 0 )
		{
			if ( k % 2 != 0 )
			{
				sort(v.begin() , v.end() );
				v[0] *= -1 ;
			}
		}
	}

	long long sum = 0 ;
	for ( int i = 0 ;i < n ; i++ )
		sum += v[i] ;

	cout << sum << endl;

	return 0;
}


#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <list>
#include <map>
#include <algorithm>
#include <math.h>
#include <iomanip>

using namespace std ;

bool compare ( pair<long long , int > p1 , pair<long long , int > p2 )
{
	return ( p1.second > p2.second ) ;
}

int f[200000],s[200000];
long long a[10000001] ;
//int ar[1000000];
	int ar[200] ;
/*
void solve(int i ,vector<vector<int>> &inputs)
{
	ar[i]-- ;
	inputs[i].clear() ;
	int x = inputs[i].front() ;

	//vector<int> ::iterator it = find(inputs[x].begin(), inputs[x].end(),i ) ;
//	inputs[x].erase(std::remove(inputs[x].begin(), inputs[x].end(), i ) , inputs[x].end() ) ;
	//it = inputs[x].erase(it) ;
}	*/

int main()
{
	ios::sync_with_stdio(0);cin.tie(0);ios_base::sync_with_stdio(0);

	/*int X[51][2] , Y[51][2];
	int p , q , l , r , a , b , c ,d ;

	cin >> p >> q >> l >> r ;
	for ( int i = 0 ; i < p ; i++ )
		cin >> X[i][2] ;
	for ( int i = 0 ; i < q ; i++ )
		cin >> Y[i][2] ;

	for ( int i = 0 ; i < q ; i++ )
	{
		for ( int j = l ; j <= r ; j++ )
		{
			if ( Y[0][0] + j && Y[0][1] + j > X[0][0] = X[0][1]
		}

	}*/

	int n , k ;

	cin >> n >> k ;
	vector<int> v(n) ;

	int negatives = 0 ;

	for ( int i = 0 ;i < n ; i++ )
	{
		cin >> v[i] ;
		if ( v[i] < 0 )
			negatives++ ;
	}
	/*

	if ( negatives >= k )
	{
		for ( int i = 0 ; i < n ; i++ )
		{
			if ( k == 0 )
				break;
			if ( v[i] < 0 )
			{
				v[i] = v[i]*-1 ;
			}
			k-- ;
		}
	}
	else
	{
		int index = -1 ;
		bool flag = false ;
		for ( int i = 0 ; i < n-1 ; i++ )
		{
			k-- ;
			if ( v[i] < 0 && v[i+1] < 0 )
			{
				v[i] = v[i]*-1 ;
				//k-- ;
			}
			else
				flag = 1 ;

			if (flag)
			{
				v[i] = v[i] *-1 ;
				flag = 0 ;
				index = i+1 ;
				break ;
				//k-- ;
			}
		}
		if ( k % 2 != 0 )
		{

			v[index] = v[index] * -1 ;
		}
	}
	*/

	long long min = 999999 ;
	int indmin = -1  ;
	bool fof = false , an = false ;
	int index = -1 ;
	for ( int i = 0 ;i < n ;i++ )
	{
		if ( k == 0 )
			break ;

		if ( v[i] < 0 ) {
			v[i] = v[i] * -1 ;
			k-- ;
			if ( v[i] < min )
			{
				min = v[i] ;
				indmin = i ;
			}
			//continue ;
		}
		else
		{
			index = i ;
			fof = 1 ;
			an = 1 ;
			break ;
		}

	}

	if ( k > 0 )
	{
		if ( !an )
		{
			if ( k % 2 != 0 )
			{
				v[n-1] = v[n-1] * -1 ;
			}
		}

		if ( fof == 1 && negatives == 0 )
		{
			if ( k % 2 != 0 )
			{
				v[index] = v[index] * -1 ;
			}
		}
		else if ( fof == 1 && negatives != 0 )
		{
			if ( k % 2 != 0 )
			{
				v[indmin] = v[indmin] * -1 ;
			}
		}
	}

	long long sum = 0 ;
	for ( int i = 0 ;i < n ; i++ )
		sum += v[i] ;

	cout << sum << endl;

	return 0;
}


#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <list>
#include <map>
#include <algorithm>
#include <math.h>
#include <iomanip>

using namespace std ;

bool compare ( pair<long long , int > p1 , pair<long long , int > p2 )
{
	return ( p1.second > p2.second ) ;
}

int f[200000],s[200000];
long long a[10000001] ;
//int ar[1000000];
	int ar[200] ;
/*
void solve(int i ,vector<vector<int>> &inputs)
{
	ar[i]-- ;
	inputs[i].clear() ;
	int x = inputs[i].front() ;

	//vector<int> ::iterator it = find(inputs[x].begin(), inputs[x].end(),i ) ;
//	inputs[x].erase(std::remove(inputs[x].begin(), inputs[x].end(), i ) , inputs[x].end() ) ;
	//it = inputs[x].erase(it) ;
}	*/

int main()
{
	ios::sync_with_stdio(0);cin.tie(0);ios_base::sync_with_stdio(0);

	/*int X[51][2] , Y[51][2];
	int p , q , l , r , a , b , c ,d ;

	cin >> p >> q >> l >> r ;
	for ( int i = 0 ; i < p ; i++ )
		cin >> X[i][2] ;
	for ( int i = 0 ; i < q ; i++ )
		cin >> Y[i][2] ;

	for ( int i = 0 ; i < q ; i++ )
	{
		for ( int j = l ; j <= r ; j++ )
		{
			if ( Y[0][0] + j && Y[0][1] + j > X[0][0] = X[0][1]
		}

	}*/

	int n , k ;

	cin >> n >> k ;
	vector<int> v(n) ;

	int negatives = 0 ;

	for ( int i = 0 ;i < n ; i++ )
	{
		cin >> v[i] ;
		if ( v[i] < 0 )
			negatives++ ;
	}
	/*

	if ( negatives >= k )
	{
		for ( int i = 0 ; i < n ; i++ )
		{
			if ( k == 0 )
				break;
			if ( v[i] < 0 )
			{
				v[i] = v[i]*-1 ;
			}
			k-- ;
		}
	}
	else
	{
		int index = -1 ;
		bool flag = false ;
		for ( int i = 0 ; i < n-1 ; i++ )
		{
			k-- ;
			if ( v[i] < 0 && v[i+1] < 0 )
			{
				v[i] = v[i]*-1 ;
				//k-- ;
			}
			else
				flag = 1 ;

			if (flag)
			{
				v[i] = v[i] *-1 ;
				flag = 0 ;
				index = i+1 ;
				break ;
				//k-- ;
			}
		}
		if ( k % 2 != 0 )
		{

			v[index] = v[index] * -1 ;
		}
	}
	*/

	bool fof = false , an = false ;
	int index = -1 ;
	for ( int i = 0 ;i < n ;i++ )
	{
		if ( k == 0 )
			break ;

		if ( v[i] < 0 ) {
			v[i] = v[i] * -1 ;
			k-- ;
			//continue ;
		}
		else
		{
			index = i ;
			fof = 1 ;
			break ;
		}

		if ( fof == 0 && k > 0 )
		{
			an = 1 ;
		}

	}

	if ( k > 0 )
	{
		if ( an )
		{
			if ( k % 2 != 0 )
			{
				v[index] = v[index] * -1 ;
			}
		}

		if ( fof == 1 && negatives == 0 )
		{
			if ( k % 2 != 0 )
			{
				v[index] = v[index] * -1 ;
			}
		}
		else if ( fof == 1 && negatives != 0 )
		{
			if ( k % 2 != 0 )
			{
				v[index] = v[index] * -1 ;
			}
		}
	}

	long long sum = 0 ;
	for ( int i = 0 ;i < n ; i++ )
		sum += v[i] ;

	cout << sum << endl;

	return 0;
}


#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <list>
#include <map>
#include <algorithm>
#include <math.h>
#include <iomanip>

using namespace std ;

bool compare ( pair<long long , int > p1 , pair<long long , int > p2 )
{
	return ( p1.second > p2.second ) ;
}

int f[200000],s[200000];
long long a[10000001] ;
//int ar[1000000];
	int ar[200] ;
/*
void solve(int i ,vector<vector<int>> &inputs)
{
	ar[i]-- ;
	inputs[i].clear() ;
	int x = inputs[i].front() ;

	//vector<int> ::iterator it = find(inputs[x].begin(), inputs[x].end(),i ) ;
//	inputs[x].erase(std::remove(inputs[x].begin(), inputs[x].end(), i ) , inputs[x].end() ) ;
	//it = inputs[x].erase(it) ;
}	*/

int main()
{
	ios::sync_with_stdio(0);cin.tie(0);ios_base::sync_with_stdio(0);

	/*int X[51][2] , Y[51][2];
	int p , q , l , r , a , b , c ,d ;

	cin >> p >> q >> l >> r ;
	for ( int i = 0 ; i < p ; i++ )
		cin >> X[i][2] ;
	for ( int i = 0 ; i < q ; i++ )
		cin >> Y[i][2] ;

	for ( int i = 0 ; i < q ; i++ )
	{
		for ( int j = l ; j <= r ; j++ )
		{
			if ( Y[0][0] + j && Y[0][1] + j > X[0][0] = X[0][1]
		}

	}*/

	int n , k ;

	cin >> n >> k ;
	vector<int> v(n) ;

	int negatives = 0 ;

	for ( int i = 0 ;i < n ; i++ )
	{
		cin >> v[i] ;
		if ( v[i] < 0 )
			negatives++ ;
	}
	/*

	if ( negatives >= k )
	{
		for ( int i = 0 ; i < n ; i++ )
		{
			if ( k == 0 )
				break;
			if ( v[i] < 0 )
			{
				v[i] = v[i]*-1 ;
			}
			k-- ;
		}
	}
	else
	{
		int index = -1 ;
		bool flag = false ;
		for ( int i = 0 ; i < n-1 ; i++ )
		{
			k-- ;
			if ( v[i] < 0 && v[i+1] < 0 )
			{
				v[i] = v[i]*-1 ;
				//k-- ;
			}
			else
				flag = 1 ;

			if (flag)
			{
				v[i] = v[i] *-1 ;
				flag = 0 ;
				index = i+1 ;
				break ;
				//k-- ;
			}
		}
		if ( k % 2 != 0 )
		{

			v[index] = v[index] * -1 ;
		}
	}
	*/

	bool fof = false , an = false ;
	int index = -1 ;
	for ( int i = 0 ;i < n ;i++ )
	{
		if ( k == 0 )
			break ;

		if ( v[i] < 0 ) {
			v[i] = v[i] * -1 ;
			k-- ;
			//continue ;
		}
		else
		{
			index = i ;
			fof = 1 ;
			an = 1 ;
			break ;
		}

	}

	if ( k > 0 )
	{
		if ( !an )
		{
			if ( k % 2 != 0 )
			{
				v[n-1] = v[n-1] * -1 ;
			}
		}

		if ( fof == 1 && negatives == 0 )
		{
			if ( k % 2 != 0 )
			{
				v[index] = v[index] * -1 ;
			}
		}
		else if ( fof == 1 && negatives != 0 )
		{
			if ( k % 2 != 0 )
			{
				v[index] = v[index] * -1 ;
			}
		}
	}

	long long sum = 0 ;
	for ( int i = 0 ;i < n ; i++ )
		sum += v[i] ;

	cout << sum << endl;

	return 0;
}


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

#define          IOS                    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define          ll                     long long int
#define          EPS                    10E-10
#define          ull                    unsigned long long int
#define          db                     double
#define          pii                    pair < int, int>
#define          pll                    pair < ll, ll>
#define          MOD                    1000000007
#define          vi                     vector<int>
#define          vl                     vector<ll>
#define          pb                     push_back
#define          sc                     scanf
#define          pf                     printf
#define          scin(x)                scanf("%d",&(x))
#define          scin2(x,y)             scanf("%d %d",&(x),&(y))
#define          scln(x)                scanf("%lld",&(x))
#define          scln2(x,y)             scanf("%lld %lld",&(x),&(y))
#define          min3(a,b,c)            min(a,min(b,c))
#define          min4(a,b,c,d)          min(d,min(a,min(b,c)))
#define          max3(a,b,c)            max(a,max(b,c))
#define          max4(a,b,c,d)          max(d,max(a,max(b,c)))
#define          ms(a,b)                memset(a,b,sizeof(a))
#define          gcd(a, b)              __gcd(a,b)
#define          lcm(a, b)              ((a)*(b)/gcd(a,b))
#define          input                  freopen("input.txt","rt", stdin)
#define          output                 freopen("output.txt","wt", stdout)
#define          PI                     3.141592653589793238462643
#define          rep( i , a , b )       for( i=a ; i<b ; i++)
#define          rev( i , a , b )       for( i=a ; i>=b ; i--)
#define          repx( i ,a,b, x)       for( i=a ; i<b ; i+=x)
#define          RUN_CASE(t,T)          for(__typeof(t) t=1;t<=T;t++)
#define          zero(a)                memset(a,0,sizeof a)
#define          all(v)                 v.begin(),v.end()
#define          get_pos(c,x)           (lower_bound(c.begin(),c.end(),x)-c.begin())
#define          CASEL(t)               printf("Case %d:\n",t)
#define          Unique(X)             (X).erase(unique(all(X)),(X).end())
/*
ll NcR[200010][2];

ll ncr(ll n,ll r)
{
    if(r==0)return 1;
    if(r==1)return n;
    if(n==r)return 1;
    if(NcR[n][r]!=0)
    {
        return NcR[n][r];
    }
    else
    {
        NcR[n][r]=ncr(n-1,r)+ncr(n-1,r-1);
        return NcR[n][r];
    }
}
*/

///--------------Graph Moves--------------------------------------
///const int fx[] = {+1,-1,+0,+0};
///const int fy[] = {+0,+0,+1,-1};
///const int fx[] = {+0,+0,+1,-1,-1,+1,-1,+1}; ///King's move
///const int fy[] = {-1,+1,+0,+0,+1,+1,-1,-1}; ///king's Move
///const int fx[] = {-2,-2,-1,-1,+1,+1,+2,+2}; ///knight's move
///const int fy[] = {-1,+1,-2,+2,-2,+2,-1,+1}; ///knight's move
///---------------------------------------------------------------
/*
ll knx[]= {+2,+2,+1,+1,-1,-1,-2,-2};
ll kny[]= {-1,+1,-2,+2,-2,+2,-1,+1};
*/
map<string, ll>month ;
void Month()
{
    month["January"] = 1, month["February"] = 2, month["March"] = 3, month["April"] = 4, month["May"] = 5, month["June"] = 6 ;
    month["July"] = 7, month["August"] = 8, month["September"] = 9, month["October"] = 10, month["November"] = 11, month["December"] = 12 ;
}

ll arr[10000000+7];
ll arr2[10000000+7];

int main()
{
    // input;
    // output;
    // cout<<"Case "<<i<<": ";
    IOS;
    bool check=true;
    ll n,k,s=0;
    cin>>n>>k;
    for(ll i=0;i<n;i++)
    {
        cin>>arr[i];
    }
    for(ll i=0;i<n;i++)
    {
        if(arr[i]<=0&&k>0)
        {
            arr[i]*=-1;
            k--;
        }
    }
    sort(arr,arr+n);
    if(k>0)
    {
        if(k&1)
        {
            for(ll i=0;i<n;i++)
            {
                if(arr[i]==0)check=false;
            }

            if(!check)arr[0]*=-1;

        }
    }
    for(ll i=0;i<n;i++)s+=arr[i];
    cout<<s<<endl;

    return 0;
}
/*

*/


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

#define          IOS                    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define          ll                     long long int
#define          EPS                    10E-10
#define          ull                    unsigned long long int
#define          db                     double
#define          pii                    pair < int, int>
#define          pll                    pair < ll, ll>
#define          MOD                    1000000007
#define          vi                     vector<int>
#define          vl                     vector<ll>
#define          pb                     push_back
#define          sc                     scanf
#define          pf                     printf
#define          scin(x)                scanf("%d",&(x))
#define          scin2(x,y)             scanf("%d %d",&(x),&(y))
#define          scln(x)                scanf("%lld",&(x))
#define          scln2(x,y)             scanf("%lld %lld",&(x),&(y))
#define          min3(a,b,c)            min(a,min(b,c))
#define          min4(a,b,c,d)          min(d,min(a,min(b,c)))
#define          max3(a,b,c)            max(a,max(b,c))
#define          max4(a,b,c,d)          max(d,max(a,max(b,c)))
#define          ms(a,b)                memset(a,b,sizeof(a))
#define          gcd(a, b)              __gcd(a,b)
#define          lcm(a, b)              ((a)*(b)/gcd(a,b))
#define          input                  freopen("input.txt","rt", stdin)
#define          output                 freopen("output.txt","wt", stdout)
#define          PI                     3.141592653589793238462643
#define          rep( i , a , b )       for( i=a ; i<b ; i++)
#define          rev( i , a , b )       for( i=a ; i>=b ; i--)
#define          repx( i ,a,b, x)       for( i=a ; i<b ; i+=x)
#define          RUN_CASE(t,T)          for(__typeof(t) t=1;t<=T;t++)
#define          zero(a)                memset(a,0,sizeof a)
#define          all(v)                 v.begin(),v.end()
#define          get_pos(c,x)           (lower_bound(c.begin(),c.end(),x)-c.begin())
#define          CASEL(t)               printf("Case %d:\n",t)
#define          Unique(X)             (X).erase(unique(all(X)),(X).end())
/*
ll NcR[200010][2];

ll ncr(ll n,ll r)
{
    if(r==0)return 1;
    if(r==1)return n;
    if(n==r)return 1;
    if(NcR[n][r]!=0)
    {
        return NcR[n][r];
    }
    else
    {
        NcR[n][r]=ncr(n-1,r)+ncr(n-1,r-1);
        return NcR[n][r];
    }
}
*/

///--------------Graph Moves--------------------------------------
///const int fx[] = {+1,-1,+0,+0};
///const int fy[] = {+0,+0,+1,-1};
///const int fx[] = {+0,+0,+1,-1,-1,+1,-1,+1}; ///King's move
///const int fy[] = {-1,+1,+0,+0,+1,+1,-1,-1}; ///king's Move
///const int fx[] = {-2,-2,-1,-1,+1,+1,+2,+2}; ///knight's move
///const int fy[] = {-1,+1,-2,+2,-2,+2,-1,+1}; ///knight's move
///---------------------------------------------------------------
/*
ll knx[]= {+2,+2,+1,+1,-1,-1,-2,-2};
ll kny[]= {-1,+1,-2,+2,-2,+2,-1,+1};
*/
map<string, ll>month ;
void Month()
{
    month["January"] = 1, month["February"] = 2, month["March"] = 3, month["April"] = 4, month["May"] = 5, month["June"] = 6 ;
    month["July"] = 7, month["August"] = 8, month["September"] = 9, month["October"] = 10, month["November"] = 11, month["December"] = 12 ;
}

ll arr[10000000+7];
ll arr2[10000000+7];

int main()
{
    // input;
    // output;
    // cout<<"Case "<<i<<": ";
    IOS;
    bool check=true;
    ll n,k,s=0;
    cin>>n>>k;
    for(ll i=0;i<n;i++)
    {
        cin>>arr[i];
    }
    for(ll i=0;i<n;i++)
    {
        if(arr[i]<=0&&k>0)
        {
            arr[i]*=-1;
            k--;
        }
    }
    for(ll i=n-1;i>=0;i--)
    {
        if(arr[i]<=0||k==0)
        {
            if(k&1)arr[i]*=-1;
                check=false;
        }
    }
    if(check&&(k&1))arr[0]*=-1;
    for(ll i=0;i<n;i++)
    {
        s+=arr[i];
    }
    cout<<s<<endl;

    return 0;
}
/*

*/


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

#define          IOS                    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define          ll                     long long int
#define          EPS                    10E-10
#define          ull                    unsigned long long int
#define          db                     double
#define          pii                    pair < int, int>
#define          pll                    pair < ll, ll>
#define          MOD                    1000000007
#define          vi                     vector<int>
#define          vl                     vector<ll>
#define          pb                     push_back
#define          sc                     scanf
#define          pf                     printf
#define          scin(x)                scanf("%d",&(x))
#define          scin2(x,y)             scanf("%d %d",&(x),&(y))
#define          scln(x)                scanf("%lld",&(x))
#define          scln2(x,y)             scanf("%lld %lld",&(x),&(y))
#define          min3(a,b,c)            min(a,min(b,c))
#define          min4(a,b,c,d)          min(d,min(a,min(b,c)))
#define          max3(a,b,c)            max(a,max(b,c))
#define          max4(a,b,c,d)          max(d,max(a,max(b,c)))
#define          ms(a,b)                memset(a,b,sizeof(a))
#define          gcd(a, b)              __gcd(a,b)
#define          lcm(a, b)              ((a)*(b)/gcd(a,b))
#define          input                  freopen("input.txt","rt", stdin)
#define          output                 freopen("output.txt","wt", stdout)
#define          PI                     3.141592653589793238462643
#define          rep( i , a , b )       for( i=a ; i<b ; i++)
#define          rev( i , a , b )       for( i=a ; i>=b ; i--)
#define          repx( i ,a,b, x)       for( i=a ; i<b ; i+=x)
#define          RUN_CASE(t,T)          for(__typeof(t) t=1;t<=T;t++)
#define          zero(a)                memset(a,0,sizeof a)
#define          all(v)                 v.begin(),v.end()
#define          get_pos(c,x)           (lower_bound(c.begin(),c.end(),x)-c.begin())
#define          CASEL(t)               printf("Case %d:\n",t)
#define          Unique(X)             (X).erase(unique(all(X)),(X).end())
/*
ll NcR[200010][2];

ll ncr(ll n,ll r)
{
    if(r==0)return 1;
    if(r==1)return n;
    if(n==r)return 1;
    if(NcR[n][r]!=0)
    {
        return NcR[n][r];
    }
    else
    {
        NcR[n][r]=ncr(n-1,r)+ncr(n-1,r-1);
        return NcR[n][r];
    }
}
*/

///--------------Graph Moves--------------------------------------
///const int fx[] = {+1,-1,+0,+0};
///const int fy[] = {+0,+0,+1,-1};
///const int fx[] = {+0,+0,+1,-1,-1,+1,-1,+1}; ///King's move
///const int fy[] = {-1,+1,+0,+0,+1,+1,-1,-1}; ///king's Move
///const int fx[] = {-2,-2,-1,-1,+1,+1,+2,+2}; ///knight's move
///const int fy[] = {-1,+1,-2,+2,-2,+2,-1,+1}; ///knight's move
///---------------------------------------------------------------
/*
ll knx[]= {+2,+2,+1,+1,-1,-1,-2,-2};
ll kny[]= {-1,+1,-2,+2,-2,+2,-1,+1};
*/
map<string, ll>month ;
void Month()
{
    month["January"] = 1, month["February"] = 2, month["March"] = 3, month["April"] = 4, month["May"] = 5, month["June"] = 6 ;
    month["July"] = 7, month["August"] = 8, month["September"] = 9, month["October"] = 10, month["November"] = 11, month["December"] = 12 ;
}

ll arr[10000000+7];
ll arr2[10000000+7];

int main()
{
    // input;
    // output;
    // cout<<"Case "<<i<<": ";
    IOS;
    bool check=true;
    ll n,k,s=0;
    cin>>n>>k;
    for(ll i=0; i<n; i++)
    {
        cin>>arr[i];
    }
    for(ll i=0; i<n; i++)
    {
        if(arr[i]<=0&&k>0)
        {
            arr[i]*=-1;
            k--;
        }
    }
    sort(arr,arr+n);
    if(k>0)
    {
        if(k&1)
        {
            arr[0]*=-1;
        }
    }
    for(ll i=0; i<n; i++)
        s+=arr[i];

    cout<<s<<endl;

    return 0;
}
/*

*/


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

#define          IOS                    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define          ll                     long long int
#define          EPS                    10E-10
#define          ull                    unsigned long long int
#define          db                     double
#define          pii                    pair < int, int>
#define          pll                    pair < ll, ll>
#define          MOD                    1000000007
#define          vi                     vector<int>
#define          vl                     vector<ll>
#define          pb                     push_back
#define          sc                     scanf
#define          pf                     printf
#define          scin(x)                scanf("%d",&(x))
#define          scin2(x,y)             scanf("%d %d",&(x),&(y))
#define          scln(x)                scanf("%lld",&(x))
#define          scln2(x,y)             scanf("%lld %lld",&(x),&(y))
#define          min3(a,b,c)            min(a,min(b,c))
#define          min4(a,b,c,d)          min(d,min(a,min(b,c)))
#define          max3(a,b,c)            max(a,max(b,c))
#define          max4(a,b,c,d)          max(d,max(a,max(b,c)))
#define          ms(a,b)                memset(a,b,sizeof(a))
#define          gcd(a, b)              __gcd(a,b)
#define          lcm(a, b)              ((a)*(b)/gcd(a,b))
#define          input                  freopen("input.txt","rt", stdin)
#define          output                 freopen("output.txt","wt", stdout)
#define          PI                     3.141592653589793238462643
#define          rep( i , a , b )       for( i=a ; i<b ; i++)
#define          rev( i , a , b )       for( i=a ; i>=b ; i--)
#define          repx( i ,a,b, x)       for( i=a ; i<b ; i+=x)
#define          RUN_CASE(t,T)          for(__typeof(t) t=1;t<=T;t++)
#define          zero(a)                memset(a,0,sizeof a)
#define          all(v)                 v.begin(),v.end()
#define          get_pos(c,x)           (lower_bound(c.begin(),c.end(),x)-c.begin())
#define          CASEL(t)               printf("Case %d:\n",t)
#define          Unique(X)             (X).erase(unique(all(X)),(X).end())
/*
ll NcR[200010][2];

ll ncr(ll n,ll r)
{
    if(r==0)return 1;
    if(r==1)return n;
    if(n==r)return 1;
    if(NcR[n][r]!=0)
    {
        return NcR[n][r];
    }
    else
    {
        NcR[n][r]=ncr(n-1,r)+ncr(n-1,r-1);
        return NcR[n][r];
    }
}
*/

///--------------Graph Moves--------------------------------------
///const int fx[] = {+1,-1,+0,+0};
///const int fy[] = {+0,+0,+1,-1};
///const int fx[] = {+0,+0,+1,-1,-1,+1,-1,+1}; ///King's move
///const int fy[] = {-1,+1,+0,+0,+1,+1,-1,-1}; ///king's Move
///const int fx[] = {-2,-2,-1,-1,+1,+1,+2,+2}; ///knight's move
///const int fy[] = {-1,+1,-2,+2,-2,+2,-1,+1}; ///knight's move
///---------------------------------------------------------------
/*
ll knx[]= {+2,+2,+1,+1,-1,-1,-2,-2};
ll kny[]= {-1,+1,-2,+2,-2,+2,-1,+1};
*/
map<string, ll>month ;
void Month()
{
    month["January"] = 1, month["February"] = 2, month["March"] = 3, month["April"] = 4, month["May"] = 5, month["June"] = 6 ;
    month["July"] = 7, month["August"] = 8, month["September"] = 9, month["October"] = 10, month["November"] = 11, month["December"] = 12 ;
}

ll arr[10000000+7];
ll arr2[10000000+7];

int main()
{
    // input;
    // output;
    // cout<<"Case "<<i<<": ";
    IOS;
    bool check=true;
    ll n,k,s=0;
    cin>>n>>k;
    for(ll i=0;i<n;i++)
    {
        cin>>arr[i];
    }
    for(ll i=0;i<n;i++)
    {
        if(arr[i]<=0&&k>0)
        {
            arr[i]*=-1;
            k--;
        }
    }
    sort(arr,arr+n);
    for(ll i=n-1;i>=0;i--)
    {
        if(arr[i]<=0||k==0)
        {
            if(k&1)arr[i]*=-1;
                check=false;
            break;
        }
    }
    if(check&&(k&1))arr[0]*=-1;
    for(ll i=0;i<n;i++)
    {
        s+=arr[i];
    }
    cout<<s<<endl;

    return 0;
}
/*

*/


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

#define          IOS                    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define          ll                     long long int
#define          EPS                    10E-10
#define          ull                    unsigned long long int
#define          db                     double
#define          pii                    pair < int, int>
#define          pll                    pair < ll, ll>
#define          MOD                    1000000007
#define          vi                     vector<int>
#define          vl                     vector<ll>
#define          pb                     push_back
#define          sc                     scanf
#define          pf                     printf
#define          scin(x)                scanf("%d",&(x))
#define          scin2(x,y)             scanf("%d %d",&(x),&(y))
#define          scln(x)                scanf("%lld",&(x))
#define          scln2(x,y)             scanf("%lld %lld",&(x),&(y))
#define          min3(a,b,c)            min(a,min(b,c))
#define          min4(a,b,c,d)          min(d,min(a,min(b,c)))
#define          max3(a,b,c)            max(a,max(b,c))
#define          max4(a,b,c,d)          max(d,max(a,max(b,c)))
#define          ms(a,b)                memset(a,b,sizeof(a))
#define          gcd(a, b)              __gcd(a,b)
#define          lcm(a, b)              ((a)*(b)/gcd(a,b))
#define          input                  freopen("input.txt","rt", stdin)
#define          output                 freopen("output.txt","wt", stdout)
#define          PI                     3.141592653589793238462643
#define          rep( i , a , b )       for( i=a ; i<b ; i++)
#define          rev( i , a , b )       for( i=a ; i>=b ; i--)
#define          repx( i ,a,b, x)       for( i=a ; i<b ; i+=x)
#define          RUN_CASE(t,T)          for(__typeof(t) t=1;t<=T;t++)
#define          zero(a)                memset(a,0,sizeof a)
#define          all(v)                 v.begin(),v.end()
#define          get_pos(c,x)           (lower_bound(c.begin(),c.end(),x)-c.begin())
#define          CASEL(t)               printf("Case %d:\n",t)
#define          Unique(X)             (X).erase(unique(all(X)),(X).end())
/*
ll NcR[200010][2];

ll ncr(ll n,ll r)
{
    if(r==0)return 1;
    if(r==1)return n;
    if(n==r)return 1;
    if(NcR[n][r]!=0)
    {
        return NcR[n][r];
    }
    else
    {
        NcR[n][r]=ncr(n-1,r)+ncr(n-1,r-1);
        return NcR[n][r];
    }
}
*/

///--------------Graph Moves--------------------------------------
///const int fx[] = {+1,-1,+0,+0};
///const int fy[] = {+0,+0,+1,-1};
///const int fx[] = {+0,+0,+1,-1,-1,+1,-1,+1}; ///King's move
///const int fy[] = {-1,+1,+0,+0,+1,+1,-1,-1}; ///king's Move
///const int fx[] = {-2,-2,-1,-1,+1,+1,+2,+2}; ///knight's move
///const int fy[] = {-1,+1,-2,+2,-2,+2,-1,+1}; ///knight's move
///---------------------------------------------------------------
/*
ll knx[]= {+2,+2,+1,+1,-1,-1,-2,-2};
ll kny[]= {-1,+1,-2,+2,-2,+2,-1,+1};
*/
map<string, ll>month ;
void Month()
{
    month["January"] = 1, month["February"] = 2, month["March"] = 3, month["April"] = 4, month["May"] = 5, month["June"] = 6 ;
    month["July"] = 7, month["August"] = 8, month["September"] = 9, month["October"] = 10, month["November"] = 11, month["December"] = 12 ;
}

ll arr[10000000+7];
ll arr2[10000000+7];

int main()
{
    // input;
    // output;
    // cout<<"Case "<<i<<": ";
    IOS;
    ll n,k,s=0;
    cin>>n>>k;
    for(ll i=0;i<n;i++)
    {
        cin>>arr[i];
    }
    for(ll i=0;i<k;i++)
    {
        arr[i]*=-1;

    }
    for(ll i=0;i<n;i++)
    {
        s+=arr[i];
    }
    cout<<s<<endl;

    return 0;
}
/*

*/


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

#define          IOS                    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define          ll                     long long int
#define          EPS                    10E-10
#define          ull                    unsigned long long int
#define          db                     double
#define          pii                    pair < int, int>
#define          pll                    pair < ll, ll>
#define          MOD                    1000000007
#define          vi                     vector<int>
#define          vl                     vector<ll>
#define          pb                     push_back
#define          sc                     scanf
#define          pf                     printf
#define          scin(x)                scanf("%d",&(x))
#define          scin2(x,y)             scanf("%d %d",&(x),&(y))
#define          scln(x)                scanf("%lld",&(x))
#define          scln2(x,y)             scanf("%lld %lld",&(x),&(y))
#define          min3(a,b,c)            min(a,min(b,c))
#define          min4(a,b,c,d)          min(d,min(a,min(b,c)))
#define          max3(a,b,c)            max(a,max(b,c))
#define          max4(a,b,c,d)          max(d,max(a,max(b,c)))
#define          ms(a,b)                memset(a,b,sizeof(a))
#define          gcd(a, b)              __gcd(a,b)
#define          lcm(a, b)              ((a)*(b)/gcd(a,b))
#define          input                  freopen("input.txt","rt", stdin)
#define          output                 freopen("output.txt","wt", stdout)
#define          PI                     3.141592653589793238462643
#define          rep( i , a , b )       for( i=a ; i<b ; i++)
#define          rev( i , a , b )       for( i=a ; i>=b ; i--)
#define          repx( i ,a,b, x)       for( i=a ; i<b ; i+=x)
#define          RUN_CASE(t,T)          for(__typeof(t) t=1;t<=T;t++)
#define          zero(a)                memset(a,0,sizeof a)
#define          all(v)                 v.begin(),v.end()
#define          get_pos(c,x)           (lower_bound(c.begin(),c.end(),x)-c.begin())
#define          CASEL(t)               printf("Case %d:\n",t)
#define          Unique(X)             (X).erase(unique(all(X)),(X).end())
/*
ll NcR[200010][2];

ll ncr(ll n,ll r)
{
    if(r==0)return 1;
    if(r==1)return n;
    if(n==r)return 1;
    if(NcR[n][r]!=0)
    {
        return NcR[n][r];
    }
    else
    {
        NcR[n][r]=ncr(n-1,r)+ncr(n-1,r-1);
        return NcR[n][r];
    }
}
*/

///--------------Graph Moves--------------------------------------
///const int fx[] = {+1,-1,+0,+0};
///const int fy[] = {+0,+0,+1,-1};
///const int fx[] = {+0,+0,+1,-1,-1,+1,-1,+1}; ///King's move
///const int fy[] = {-1,+1,+0,+0,+1,+1,-1,-1}; ///king's Move
///const int fx[] = {-2,-2,-1,-1,+1,+1,+2,+2}; ///knight's move
///const int fy[] = {-1,+1,-2,+2,-2,+2,-1,+1}; ///knight's move
///---------------------------------------------------------------
/*
ll knx[]= {+2,+2,+1,+1,-1,-1,-2,-2};
ll kny[]= {-1,+1,-2,+2,-2,+2,-1,+1};
*/
map<string, ll>month ;
void Month()
{
    month["January"] = 1, month["February"] = 2, month["March"] = 3, month["April"] = 4, month["May"] = 5, month["June"] = 6 ;
    month["July"] = 7, month["August"] = 8, month["September"] = 9, month["October"] = 10, month["November"] = 11, month["December"] = 12 ;
}

ll arr[10000000+7];
ll arr2[10000000+7];

int main()
{
    // input;
    // output;
    // cout<<"Case "<<i<<": ";
    IOS;
    bool check=true;
    ll n,k,s=0;
    cin>>n>>k;
    for(ll i=0;i<n;i++)
    {
        cin>>arr[i];
    }
    for(ll i=0;i<n;i++)
    {
        if(arr[i]<=0&&k>0)
        {
            arr[i]*=-1;
            k--;
        }
    }
    for(ll i=n-1;i>=0;i--)
    {
        if(arr[i]<=0||k==0)
        {
            if(k&1)arr[i]*=-1;
                check=false;
            break;
        }
    }
    if(check&&(k&1))arr[0]*=-1;
    for(ll i=0;i<n;i++)
    {
        s+=arr[i];
    }
    cout<<s<<endl;

    return 0;
}
/*

*/


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

#define          IOS                    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define          ll                     long long int
#define          EPS                    10E-10
#define          ull                    unsigned long long int
#define          db                     double
#define          pii                    pair < int, int>
#define          pll                    pair < ll, ll>
#define          MOD                    1000000007
#define          vi                     vector<int>
#define          vl                     vector<ll>
#define          pb                     push_back
#define          sc                     scanf
#define          pf                     printf
#define          scin(x)                scanf("%d",&(x))
#define          scin2(x,y)             scanf("%d %d",&(x),&(y))
#define          scln(x)                scanf("%lld",&(x))
#define          scln2(x,y)             scanf("%lld %lld",&(x),&(y))
#define          min3(a,b,c)            min(a,min(b,c))
#define          min4(a,b,c,d)          min(d,min(a,min(b,c)))
#define          max3(a,b,c)            max(a,max(b,c))
#define          max4(a,b,c,d)          max(d,max(a,max(b,c)))
#define          ms(a,b)                memset(a,b,sizeof(a))
#define          gcd(a, b)              __gcd(a,b)
#define          lcm(a, b)              ((a)*(b)/gcd(a,b))
#define          input                  freopen("input.txt","rt", stdin)
#define          output                 freopen("output.txt","wt", stdout)
#define          PI                     3.141592653589793238462643
#define          rep( i , a , b )       for( i=a ; i<b ; i++)
#define          rev( i , a , b )       for( i=a ; i>=b ; i--)
#define          repx( i ,a,b, x)       for( i=a ; i<b ; i+=x)
#define          RUN_CASE(t,T)          for(__typeof(t) t=1;t<=T;t++)
#define          zero(a)                memset(a,0,sizeof a)
#define          all(v)                 v.begin(),v.end()
#define          get_pos(c,x)           (lower_bound(c.begin(),c.end(),x)-c.begin())
#define          CASEL(t)               printf("Case %d:\n",t)
#define          Unique(X)             (X).erase(unique(all(X)),(X).end())
/*
ll NcR[200010][2];

ll ncr(ll n,ll r)
{
    if(r==0)return 1;
    if(r==1)return n;
    if(n==r)return 1;
    if(NcR[n][r]!=0)
    {
        return NcR[n][r];
    }
    else
    {
        NcR[n][r]=ncr(n-1,r)+ncr(n-1,r-1);
        return NcR[n][r];
    }
}
*/

///--------------Graph Moves--------------------------------------
///const int fx[] = {+1,-1,+0,+0};
///const int fy[] = {+0,+0,+1,-1};
///const int fx[] = {+0,+0,+1,-1,-1,+1,-1,+1}; ///King's move
///const int fy[] = {-1,+1,+0,+0,+1,+1,-1,-1}; ///king's Move
///const int fx[] = {-2,-2,-1,-1,+1,+1,+2,+2}; ///knight's move
///const int fy[] = {-1,+1,-2,+2,-2,+2,-1,+1}; ///knight's move
///---------------------------------------------------------------
/*
ll knx[]= {+2,+2,+1,+1,-1,-1,-2,-2};
ll kny[]= {-1,+1,-2,+2,-2,+2,-1,+1};
*/
map<string, ll>month ;
void Month()
{
    month["January"] = 1, month["February"] = 2, month["March"] = 3, month["April"] = 4, month["May"] = 5, month["June"] = 6 ;
    month["July"] = 7, month["August"] = 8, month["September"] = 9, month["October"] = 10, month["November"] = 11, month["December"] = 12 ;
}

ll arr[10000000+7];
ll arr2[10000000+7];

int main()
{
    // input;
    // output;
    // cout<<"Case "<<i<<": ";
    IOS;
    ll n,k,s=0;
    cin>>n>>k;
    for(ll i=0;i<n;i++)
    {
        cin>>arr[i];
    }
    for(ll i=0;i<n;i++)
    {
        if(k>0&&arr[i]<0)
        {
        arr[i]*=-1;
        k--;
        }

    }
    for(ll i=0;i<n;i++)
    {
        s+=arr[i];
    }
    cout<<s<<endl;

    return 0;
}
/*

*/


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

#define          IOS                    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define          ll                     long long int
#define          EPS                    10E-10
#define          ull                    unsigned long long int
#define          db                     double
#define          pii                    pair < int, int>
#define          pll                    pair < ll, ll>
#define          MOD                    1000000007
#define          vi                     vector<int>
#define          vl                     vector<ll>
#define          pb                     push_back
#define          sc                     scanf
#define          pf                     printf
#define          scin(x)                scanf("%d",&(x))
#define          scin2(x,y)             scanf("%d %d",&(x),&(y))
#define          scln(x)                scanf("%lld",&(x))
#define          scln2(x,y)             scanf("%lld %lld",&(x),&(y))
#define          min3(a,b,c)            min(a,min(b,c))
#define          min4(a,b,c,d)          min(d,min(a,min(b,c)))
#define          max3(a,b,c)            max(a,max(b,c))
#define          max4(a,b,c,d)          max(d,max(a,max(b,c)))
#define          ms(a,b)                memset(a,b,sizeof(a))
#define          gcd(a, b)              __gcd(a,b)
#define          lcm(a, b)              ((a)*(b)/gcd(a,b))
#define          input                  freopen("input.txt","rt", stdin)
#define          output                 freopen("output.txt","wt", stdout)
#define          PI                     3.141592653589793238462643
#define          rep( i , a , b )       for( i=a ; i<b ; i++)
#define          rev( i , a , b )       for( i=a ; i>=b ; i--)
#define          repx( i ,a,b, x)       for( i=a ; i<b ; i+=x)
#define          RUN_CASE(t,T)          for(__typeof(t) t=1;t<=T;t++)
#define          zero(a)                memset(a,0,sizeof a)
#define          all(v)                 v.begin(),v.end()
#define          get_pos(c,x)           (lower_bound(c.begin(),c.end(),x)-c.begin())
#define          CASEL(t)               printf("Case %d:\n",t)
#define          Unique(X)             (X).erase(unique(all(X)),(X).end())
/*
ll NcR[200010][2];

ll ncr(ll n,ll r)
{
    if(r==0)return 1;
    if(r==1)return n;
    if(n==r)return 1;
    if(NcR[n][r]!=0)
    {
        return NcR[n][r];
    }
    else
    {
        NcR[n][r]=ncr(n-1,r)+ncr(n-1,r-1);
        return NcR[n][r];
    }
}
*/

///--------------Graph Moves--------------------------------------
///const int fx[] = {+1,-1,+0,+0};
///const int fy[] = {+0,+0,+1,-1};
///const int fx[] = {+0,+0,+1,-1,-1,+1,-1,+1}; ///King's move
///const int fy[] = {-1,+1,+0,+0,+1,+1,-1,-1}; ///king's Move
///const int fx[] = {-2,-2,-1,-1,+1,+1,+2,+2}; ///knight's move
///const int fy[] = {-1,+1,-2,+2,-2,+2,-1,+1}; ///knight's move
///---------------------------------------------------------------
/*
ll knx[]= {+2,+2,+1,+1,-1,-1,-2,-2};
ll kny[]= {-1,+1,-2,+2,-2,+2,-1,+1};
*/
map<string, ll>month ;
void Month()
{
    month["January"] = 1, month["February"] = 2, month["March"] = 3, month["April"] = 4, month["May"] = 5, month["June"] = 6 ;
    month["July"] = 7, month["August"] = 8, month["September"] = 9, month["October"] = 10, month["November"] = 11, month["December"] = 12 ;
}

ll arr[10000000+7];
ll arr2[10000000+7];

int main()
{
    // input;
    // output;
    // cout<<"Case "<<i<<": ";
    IOS;
    ll n,k,s=0;
    cin>>n>>k;
    for(ll i=0;i<n;i++)
    {
        cin>>arr[i];
    }
    for(ll i=0;i<n;i++)
    {
        if(arr[i]<0&&k>0)
        {
            arr[i]*=-1;
            k--;
        }
    }
    if(k&1)arr[0]*=-1;
    for(ll i=0;i<n;i++)
    {
        s+=arr[i];
    }
    cout<<s<<endl;

    return 0;
}
/*

*/


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

#define          IOS                    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define          ll                     long long int
#define          EPS                    10E-10
#define          ull                    unsigned long long int
#define          db                     double
#define          pii                    pair < int, int>
#define          pll                    pair < ll, ll>
#define          MOD                    1000000007
#define          vi                     vector<int>
#define          vl                     vector<ll>
#define          pb                     push_back
#define          sc                     scanf
#define          pf                     printf
#define          scin(x)                scanf("%d",&(x))
#define          scin2(x,y)             scanf("%d %d",&(x),&(y))
#define          scln(x)                scanf("%lld",&(x))
#define          scln2(x,y)             scanf("%lld %lld",&(x),&(y))
#define          min3(a,b,c)            min(a,min(b,c))
#define          min4(a,b,c,d)          min(d,min(a,min(b,c)))
#define          max3(a,b,c)            max(a,max(b,c))
#define          max4(a,b,c,d)          max(d,max(a,max(b,c)))
#define          ms(a,b)                memset(a,b,sizeof(a))
#define          gcd(a, b)              __gcd(a,b)
#define          lcm(a, b)              ((a)*(b)/gcd(a,b))
#define          input                  freopen("input.txt","rt", stdin)
#define          output                 freopen("output.txt","wt", stdout)
#define          PI                     3.141592653589793238462643
#define          rep( i , a , b )       for( i=a ; i<b ; i++)
#define          rev( i , a , b )       for( i=a ; i>=b ; i--)
#define          repx( i ,a,b, x)       for( i=a ; i<b ; i+=x)
#define          RUN_CASE(t,T)          for(__typeof(t) t=1;t<=T;t++)
#define          zero(a)                memset(a,0,sizeof a)
#define          all(v)                 v.begin(),v.end()
#define          get_pos(c,x)           (lower_bound(c.begin(),c.end(),x)-c.begin())
#define          CASEL(t)               printf("Case %d:\n",t)
#define          Unique(X)             (X).erase(unique(all(X)),(X).end())
/*
ll NcR[200010][2];

ll ncr(ll n,ll r)
{
    if(r==0)return 1;
    if(r==1)return n;
    if(n==r)return 1;
    if(NcR[n][r]!=0)
    {
        return NcR[n][r];
    }
    else
    {
        NcR[n][r]=ncr(n-1,r)+ncr(n-1,r-1);
        return NcR[n][r];
    }
}
*/

///--------------Graph Moves--------------------------------------
///const int fx[] = {+1,-1,+0,+0};
///const int fy[] = {+0,+0,+1,-1};
///const int fx[] = {+0,+0,+1,-1,-1,+1,-1,+1}; ///King's move
///const int fy[] = {-1,+1,+0,+0,+1,+1,-1,-1}; ///king's Move
///const int fx[] = {-2,-2,-1,-1,+1,+1,+2,+2}; ///knight's move
///const int fy[] = {-1,+1,-2,+2,-2,+2,-1,+1}; ///knight's move
///---------------------------------------------------------------
/*
ll knx[]= {+2,+2,+1,+1,-1,-1,-2,-2};
ll kny[]= {-1,+1,-2,+2,-2,+2,-1,+1};
*/
map<string, ll>month ;
void Month()
{
    month["January"] = 1, month["February"] = 2, month["March"] = 3, month["April"] = 4, month["May"] = 5, month["June"] = 6 ;
    month["July"] = 7, month["August"] = 8, month["September"] = 9, month["October"] = 10, month["November"] = 11, month["December"] = 12 ;
}

ll arr[10000000+7];
ll arr2[10000000+7];

int main()
{
    // input;
    // output;
    // cout<<"Case "<<i<<": ";
    IOS;
    bool check=true;
    ll n,k,s=0;
    cin>>n>>k;
    for(ll i=0;i<n;i++)
    {
        cin>>arr[i];
    }
    for(ll i=0;i<n;i++)
    {
        if(arr[i]<=0&&k>0)
        {
            arr[i]*=-1;
            k--;
        }
    }
    for(ll i=n-1;i>=0;i--)
    {
        if(arr[i]<=0||k==0)
        {
            if(k&1)arr[i]*=-1;
                check=false;
        }
    }
    if(check)arr[0]*=-1;
    for(ll i=0;i<n;i++)
    {
        s+=arr[i];
    }
    cout<<s<<endl;

    return 0;
}
/*

*/


#include<bits/stdc++.h>
#define N 1000001
#define f(i,a,b) for(ll  i=a;i<b;i++)
#define f_(i,a,b) for(ll  i=a;i>=b;i--)
#define T_ ll T; cin>>T; while(T--)
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL)
#define pb push_back
#define mp make_pair
#define pair_i pair<int,int>
#define pair_ll pair<ll,ll>
#define read(A,n) for(ll  i=0;i<n;i++) cin>>A[i]
#define pr(A,n)  for(ll  i=0;i<n;i++) cout<<A[i]<<" "; cout<<endl
#define ff first
#define ss second
#define v_i vector<int>
#define v_ii vector<pair<int,int>>
#define map_i map<int,int>
#define map_ll map<ll,ll>
#define all(s) s.begin(),s.end()
#define endl "\n"

#define o1(a) if(local=='L'){cout<<#a<<" "<<a<<endl;}
#define o2(a,b) if(local=='L'){cout<<#a<<" "<<a<<" "<<#b<<" "<<b<<endl;}
#define o3(a,b,c) if(local=='L'){cout<<#a<<" "<<a<<" "<<#b<<" "<<b<<" "<<#c<<" "<<c<<endl;}
#define o4(a,b,c,d) if(local=='L'){cout<<#a<<" "<<a<<" "<<#b<<" "<<b<<" "<<#c<<" "<<c<<" "<<#d<<" "<<d<<endl;}

char local='O';
typedef long long ll ;
typedef long double ld;

using namespace std;

int main()
{
    //fast;
   //local='L';
   //local='L';
   //T_{
//   o1(z);
   int n,k;
   cin>>n>>k;
 int A[n];
 int o=n;
 f(i,0,n)
 {
     cin>>A[i];
     if(o==n&&A[i]>=0)
        o=i;
 }
  int aa=A[0];

  f(i,0,min(o,k)){
    A[i]=-1*A[i];
  }
  if(A[0]<0&&o+1<k)
  {
      k-=o;
  if(k&1)
    A[o-1]*=-1;
  }
  else if(aa>=0)
  {
      if(k&1)
    A[0]*=-1;
  }

   o2(o,A[o-1]);
 ll sum=0;
   f(i,0,n)
   sum+=A[i]*1LL;

   cout<<sum<<endl;

  // }
  return 0;

}


#include<bits/stdc++.h>
#define N 1000001
#define f(i,a,b) for(ll  i=a;i<b;i++)
#define f_(i,a,b) for(ll  i=a;i>=b;i--)
#define T_ ll T; cin>>T; while(T--)
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL)
#define pb push_back
#define mp make_pair
#define pair_i pair<int,int>
#define pair_ll pair<ll,ll>
#define read(A,n) for(ll  i=0;i<n;i++) cin>>A[i]
#define pr(A,n)  for(ll  i=0;i<n;i++) cout<<A[i]<<" "; cout<<endl
#define ff first
#define ss second
#define v_i vector<int>
#define v_ii vector<pair<int,int>>
#define map_i map<int,int>
#define map_ll map<ll,ll>
#define all(s) s.begin(),s.end()
#define endl "\n"

#define o1(a) if(local=='L'){cout<<#a<<" "<<a<<endl;}
#define o2(a,b) if(local=='L'){cout<<#a<<" "<<a<<" "<<#b<<" "<<b<<endl;}
#define o3(a,b,c) if(local=='L'){cout<<#a<<" "<<a<<" "<<#b<<" "<<b<<" "<<#c<<" "<<c<<endl;}
#define o4(a,b,c,d) if(local=='L'){cout<<#a<<" "<<a<<" "<<#b<<" "<<b<<" "<<#c<<" "<<c<<" "<<#d<<" "<<d<<endl;}

char local='O';
typedef long long ll ;
typedef long double ld;

using namespace std;

int main()
{
    //fast;
   //local='L';
   //local='L';
   //T_{
//   o1(z);
   int n,k;
   cin>>n>>k;
 int A[n];
 int o=-1;
 f(i,0,n)
 {
     cin>>A[i];
     if(A[i]<=0)
        o=i;
 }
  int aa=A[0];

  f(i,0,min(o+1,k)){
    A[i]=-1*A[i];
  }
  k-=min(o+1,k);
  if(aa<0&&k>0)
  {
  if(k&1)
    A[o]*=-1;
  }
  else if(aa>=0)
  {
      if(k&1)
    A[0]*=-1;
  }

   o2(o,A[o-1]);
 ll sum=0;
   f(i,0,n)
   sum+=A[i]*1LL;

   cout<<sum<<endl;

  // }
  return 0;

}


#include<bits/stdc++.h>
#define N 1000001
#define f(i,a,b) for(ll  i=a;i<b;i++)
#define f_(i,a,b) for(ll  i=a;i>=b;i--)
#define T_ ll T; cin>>T; while(T--)
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL)
#define pb push_back
#define mp make_pair
#define pair_i pair<int,int>
#define pair_ll pair<ll,ll>
#define read(A,n) for(ll  i=0;i<n;i++) cin>>A[i]
#define pr(A,n)  for(ll  i=0;i<n;i++) cout<<A[i]<<" "; cout<<endl
#define ff first
#define ss second
#define v_i vector<int>
#define v_ii vector<pair<int,int>>
#define map_i map<int,int>
#define map_ll map<ll,ll>
#define all(s) s.begin(),s.end()
#define endl "\n"

#define o1(a) if(local=='L'){cout<<#a<<" "<<a<<endl;}
#define o2(a,b) if(local=='L'){cout<<#a<<" "<<a<<" "<<#b<<" "<<b<<endl;}
#define o3(a,b,c) if(local=='L'){cout<<#a<<" "<<a<<" "<<#b<<" "<<b<<" "<<#c<<" "<<c<<endl;}
#define o4(a,b,c,d) if(local=='L'){cout<<#a<<" "<<a<<" "<<#b<<" "<<b<<" "<<#c<<" "<<c<<" "<<#d<<" "<<d<<endl;}

char local='O';
typedef long long ll ;
typedef long double ld;

using namespace std;

int main()
{
    //fast;
   //local='L';
   //local='L';
   //T_{
//   o1(z);
   int n,k;
   cin>>n>>k;
 int A[n];
 int o=n;
 f(i,0,n)
 {
     cin>>A[i];
     if(o==n&&A[i]>=0)
        o=i;
 }
  int aa=A[0];

  f(i,0,min(o,k)){
    A[i]=-1*A[i];
  }
  if(aa<0&&o+1<k)
  {
      k-=o;
  if(k&1)
    A[o-1]*=-1;
  }
  else if(aa>=0)
  {
      if(k&1)
    A[0]*=-1;
  }

   o2(o,A[o-1]);
 ll sum=0;
   f(i,0,n)
   sum+=A[i]*1LL;

   cout<<sum<<endl;

  // }
  return 0;

}


#include<bits/stdc++.h>
#define N 1000001
#define f(i,a,b) for(ll  i=a;i<b;i++)
#define f_(i,a,b) for(ll  i=a;i>=b;i--)
#define T_ ll T; cin>>T; while(T--)
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL)
#define pb push_back
#define mp make_pair
#define pair_i pair<int,int>
#define pair_ll pair<ll,ll>
#define read(A,n) for(ll  i=0;i<n;i++) cin>>A[i]
#define pr(A,n)  for(ll  i=0;i<n;i++) cout<<A[i]<<" "; cout<<endl
#define ff first
#define ss second
#define v_i vector<int>
#define v_ii vector<pair<int,int>>
#define map_i map<int,int>
#define map_ll map<ll,ll>
#define all(s) s.begin(),s.end()
#define endl "\n"

#define o1(a) if(local=='L'){cout<<#a<<" "<<a<<endl;}
#define o2(a,b) if(local=='L'){cout<<#a<<" "<<a<<" "<<#b<<" "<<b<<endl;}
#define o3(a,b,c) if(local=='L'){cout<<#a<<" "<<a<<" "<<#b<<" "<<b<<" "<<#c<<" "<<c<<endl;}
#define o4(a,b,c,d) if(local=='L'){cout<<#a<<" "<<a<<" "<<#b<<" "<<b<<" "<<#c<<" "<<c<<" "<<#d<<" "<<d<<endl;}

char local='O';
typedef long long ll ;
typedef long double ld;

using namespace std;

int main()
{
    //fast;
   //local='L';
   //local='L';
   //T_{
//   o1(z);
   int n,k;
   cin>>n>>k;
 int A[n];
 int o=-1;
 f(i,0,n)
 {
     cin>>A[i];
     if(A[i]<=0)
        o=i;
 }
  int aa=A[0];

  f(i,0,min(o+1,k)){
    A[i]=-1*A[i];
  }
  k-=min(o+1,k);
  if(aa<0&&k>0)
  {
  if(k&1){
       if(o!=n-1&&A[o]>A[o+1])
    A[o+1]*=-1;
  else
    A[o]*=-1;
  }
  }
  else if(aa>=0)
  {
      if(k&1)
    A[0]*=-1;
  }

   o2(o,A[o-1]);
 ll sum=0;
   f(i,0,n)
   sum+=A[i]*1LL;

   cout<<sum<<endl;

  // }
  return 0;

}


#include<bits/stdc++.h>
#define N 1000001
#define f(i,a,b) for(ll  i=a;i<b;i++)
#define f_(i,a,b) for(ll  i=a;i>=b;i--)
#define T_ ll T; cin>>T; while(T--)
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL)
#define pb push_back
#define mp make_pair
#define pair_i pair<int,int>
#define pair_ll pair<ll,ll>
#define read(A,n) for(ll  i=0;i<n;i++) cin>>A[i]
#define pr(A,n)  for(ll  i=0;i<n;i++) cout<<A[i]<<" "; cout<<endl
#define ff first
#define ss second
#define v_i vector<int>
#define v_ii vector<pair<int,int>>
#define map_i map<int,int>
#define map_ll map<ll,ll>
#define all(s) s.begin(),s.end()
#define endl "\n"

#define o1(a) if(local=='L'){cout<<#a<<" "<<a<<endl;}
#define o2(a,b) if(local=='L'){cout<<#a<<" "<<a<<" "<<#b<<" "<<b<<endl;}
#define o3(a,b,c) if(local=='L'){cout<<#a<<" "<<a<<" "<<#b<<" "<<b<<" "<<#c<<" "<<c<<endl;}
#define o4(a,b,c,d) if(local=='L'){cout<<#a<<" "<<a<<" "<<#b<<" "<<b<<" "<<#c<<" "<<c<<" "<<#d<<" "<<d<<endl;}

char local='O';
typedef long long ll ;
typedef long double ld;

using namespace std;

int main()
{
    //fast;
   //local='L';
   //local='L';
   //T_{
//   o1(z);
   int n,k;
   cin>>n>>k;
 int A[n];
 int o=-1;
 f(i,0,n)
 {
     cin>>A[i];
     if(A[i]<0)
        o=i;
 }
  int aa=A[0];

  f(i,0,min(o+1,k)){
    A[i]=-1*A[i];
  }
  k-=min(o+1,k);
  if(aa<0&&k>0)
  {
  if(k&1)
    A[o]*=-1;
  }
  else if(aa>=0)
  {
      if(k&1)
    A[0]*=-1;
  }

   o2(o,A[o-1]);
 ll sum=0;
   f(i,0,n)
   sum+=A[i]*1LL;

   cout<<sum<<endl;

  // }
  return 0;

}


#include<bits/stdc++.h>
#define N 1000001
#define f(i,a,b) for(ll  i=a;i<b;i++)
#define f_(i,a,b) for(ll  i=a;i>=b;i--)
#define T_ ll T; cin>>T; while(T--)
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL)
#define pb push_back
#define mp make_pair
#define pair_i pair<int,int>
#define pair_ll pair<ll,ll>
#define read(A,n) for(ll  i=0;i<n;i++) cin>>A[i]
#define pr(A,n)  for(ll  i=0;i<n;i++) cout<<A[i]<<" "; cout<<endl
#define ff first
#define ss second
#define v_i vector<int>
#define v_ii vector<pair<int,int>>
#define map_i map<int,int>
#define map_ll map<ll,ll>
#define all(s) s.begin(),s.end()
#define endl "\n"

#define o1(a) if(local=='L'){cout<<#a<<" "<<a<<endl;}
#define o2(a,b) if(local=='L'){cout<<#a<<" "<<a<<" "<<#b<<" "<<b<<endl;}
#define o3(a,b,c) if(local=='L'){cout<<#a<<" "<<a<<" "<<#b<<" "<<b<<" "<<#c<<" "<<c<<endl;}
#define o4(a,b,c,d) if(local=='L'){cout<<#a<<" "<<a<<" "<<#b<<" "<<b<<" "<<#c<<" "<<c<<" "<<#d<<" "<<d<<endl;}

char local='O';
typedef long long ll ;
typedef long double ld;

using namespace std;

int main()
{
    //fast;
   //local='L';
   //local='L';
   //T_{
//   o1(z);
   int n,k;
   cin>>n>>k;
 int A[n];
 int o=n;
 f(i,0,n)
 {
     cin>>A[i];
     if(o==n&&A[i]>=0)
        o=i;
 }

  f(i,0,min(o,k)){
    A[i]=-1*A[i];
  }
  if(o+1<k)
  {
      k-=o;
  }
  if(k&1)
    A[o-1]*=-1;

   o2(o,A[o-1]);
 ll sum=0;
   f(i,0,n)
   sum+=A[i]*1LL;

   cout<<sum<<endl;

  // }
  return 0;

}


#include<bits/stdc++.h>
#define N 1000001
#define f(i,a,b) for(ll  i=a;i<b;i++)
#define f_(i,a,b) for(ll  i=a;i>=b;i--)
#define T_ ll T; cin>>T; while(T--)
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL)
#define pb push_back
#define mp make_pair
#define pair_i pair<int,int>
#define pair_ll pair<ll,ll>
#define read(A,n) for(ll  i=0;i<n;i++) cin>>A[i]
#define pr(A,n)  for(ll  i=0;i<n;i++) cout<<A[i]<<" "; cout<<endl
#define ff first
#define ss second
#define v_i vector<int>
#define v_ii vector<pair<int,int>>
#define map_i map<int,int>
#define map_ll map<ll,ll>
#define all(s) s.begin(),s.end()
#define endl "\n"

#define o1(a) if(local=='L'){cout<<#a<<" "<<a<<endl;}
#define o2(a,b) if(local=='L'){cout<<#a<<" "<<a<<" "<<#b<<" "<<b<<endl;}
#define o3(a,b,c) if(local=='L'){cout<<#a<<" "<<a<<" "<<#b<<" "<<b<<" "<<#c<<" "<<c<<endl;}
#define o4(a,b,c,d) if(local=='L'){cout<<#a<<" "<<a<<" "<<#b<<" "<<b<<" "<<#c<<" "<<c<<" "<<#d<<" "<<d<<endl;}

char local='O';
typedef long long ll ;
typedef long double ld;

using namespace std;

int main()
{
    //fast;
   //local='L';
   //local='L';
   //T_{
//   o1(z);
   int n,k;
   cin>>n>>k;
 int A[n];
 int o=n;
 f(i,0,n)
 {
     cin>>A[i];
     if(o==n&&A[i]>=0)
        o=i;
 }

  f(i,0,min(o,k)){
    A[i]=-1*A[i];
  }
  if(A[0]<0&&o+1<k)
  {
      k-=o;
  if(k&1)
    A[o-1]*=-1;
  }
  else if(A[0]>=0)
  {
      if(k&1)
    A[0]*=-1;
  }

   o2(o,A[o-1]);
 ll sum=0;
   f(i,0,n)
   sum+=A[i]*1LL;

   cout<<sum<<endl;

  // }
  return 0;

}


#include<bits/stdc++.h>
#define N 1000001
#define f(i,a,b) for(ll  i=a;i<b;i++)
#define f_(i,a,b) for(ll  i=a;i>=b;i--)
#define T_ ll T; cin>>T; while(T--)
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL)
#define pb push_back
#define mp make_pair
#define pair_i pair<int,int>
#define pair_ll pair<ll,ll>
#define read(A,n) for(ll  i=0;i<n;i++) cin>>A[i]
#define pr(A,n)  for(ll  i=0;i<n;i++) cout<<A[i]<<" "; cout<<endl
#define ff first
#define ss second
#define v_i vector<int>
#define v_ii vector<pair<int,int>>
#define map_i map<int,int>
#define map_ll map<ll,ll>
#define all(s) s.begin(),s.end()
#define endl "\n"

#define o1(a) if(local=='L'){cout<<#a<<" "<<a<<endl;}
#define o2(a,b) if(local=='L'){cout<<#a<<" "<<a<<" "<<#b<<" "<<b<<endl;}
#define o3(a,b,c) if(local=='L'){cout<<#a<<" "<<a<<" "<<#b<<" "<<b<<" "<<#c<<" "<<c<<endl;}
#define o4(a,b,c,d) if(local=='L'){cout<<#a<<" "<<a<<" "<<#b<<" "<<b<<" "<<#c<<" "<<c<<" "<<#d<<" "<<d<<endl;}

char local='O';
typedef long long ll ;
typedef long double ld;

using namespace std;

int main()
{
    //fast;
   //local='L';
   //local='L';
   //T_{
//   o1(z);
   int n,k;
   cin>>n>>k;
 int A[n];
 int o=n;
 f(i,0,n)
 {
     cin>>A[i];
     if(o==n&&A[i]>=0)
        o=i;
 }

  f(i,0,min(o,k)){
    A[i]=-1*A[i];
  }
  if(o+1<k)
  {
      k-=o;
  if(k&1)
    A[o-1]*=-1;
  }

   o2(o,A[o-1]);
 ll sum=0;
   f(i,0,n)
   sum+=A[i]*1LL;

   cout<<sum<<endl;

  // }
  return 0;

}


#include<bits/stdc++.h>
using namespace std;
int a[10000+10];
long long sum1,sum2,sum3;
bool flag;
int main()
{
    int n,k,cnt=0;
    cin>>n>>k;
    for(int i=0; i<n; i++)
    {
        cin>>a[i];
        if(a[0]>=0)
        {
            sum1+=a[i];
        }
        else if(a[i]<0)
        {
            flag=1;
            cnt++;
        }
    }
    if(!flag)
    {
        cout<<sum1;
        return 0;
    }
    else
    {
        if(k<=cnt)
        {
           // cout<<cnt<<endl;
            for(int j=0; j<k; j++)
                sum2+=abs(a[j]);
            for(int j=k; j<n; j++)
                sum3+=a[j];
        }
        else
        {
           // cout<<cnt<<endl;
            if(cnt==n)
            {
                for(int l=0; l<cnt; l++)
                    sum2+=abs(a[l]);
                sum3=0;
            }
            else
            {
                int r=k-cnt;
                for(int l=0; l<cnt-1; l++)
                    sum2+=abs(a[l]);
                   // cout<<sum2<<endl;
                if((a[cnt-1])<=a[cnt])
                {
                    //cout<<cnt<<endl;
                    if(r%2==0)
                    {
                        a[cnt-1]=1*a[cnt-1];
                        for(int l=cnt-1; l<n; l++)
                            sum3+=a[l];
                    }
                    else
                    {

                        a[cnt-1]=-1*a[cnt-1];
                        for(int l=cnt-1; l<n; l++)
                            sum3+=a[l];
                    }
                }
                else
                {
                   // cout<<abs(a[cnt-1])<< "  "<<a[cnt]<<endl;
                    //cout<<cnt<<endl;
                    if(r%2==0)
                    {
                        a[cnt]=1*a[cnt];
                        for(int l=cnt-1; l<n; l++)
                            sum3+=a[l];
                    }
                    else
                    {
                        a[cnt]=-1*a[cnt];
                        for(int l=cnt-1; l<n; l++)
                            sum3+=a[l];
                    }
                }

            }
        }
        cout<<sum2+sum3<<endl;
    }
    return 0;
}