#ifndef LOCAL
#pragma GCC optimize("O3")
#endif

#include <bits/extc++.h>

using namespace std;
using namespace __gnu_pbds;
using oset = tree<int, null_type, less<>, rb_tree_tag, tree_order_statistics_node_update>;
using ll = long long;
const ll nMax = 5100;
void solve(){
    int n, m;
    cin >> n >> m;
    vector<int> x(m);
    for(auto& o : x) cin >> o;
    ll best = -1e18;
    for(int i = 0; i < (1 << m); i++){
        ll a[2] = {0,0};
        for(int j = 0; j < m; j++){
            auto &aa = a[(i >> j)&1];
            aa = x[j] - aa;
        }
        best= max(best,a[0]+a[1]);
    }
    cout << best;
}
int main() {
#ifdef LOCAL
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    cin.tie(0)->sync_with_stdio(0);

}