# include <bits/stdc++.h>
using namespace std;
#define Roxy "minmax"
bool mtt = 0;
int test = 1;
#define ll long long
#define db double
#define ve vector
#define vi vector<int>
#define str string
#define pb push_back
#define el '\n'
#define pii pair<int,int>
#define pli pair<ll,int>
#define mp make_pair
#define fi first
#define se second
#define UNI(a) sort(ALL(a)),a.resize(unique(ALL(a))-a.begin())
#define FOR(i,a,b) for(int i=(int)(a);i<=(int)(b);i++)
#define FORD(i,a,b) for(int i=(int)(a);i>=(int)(b);i--)
#define FORN(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define ALL(a) a.begin(),a.end()
#define LB lower_bound
#define UB upper_bound
#define tct template<class T>
#define BIT(msk,i) (msk>>(i)&1)
#define MASK(i) (1ll<<(i))
#define SZ(_) (int)(_.size())
#define btpc __builtin_popcountll
ll lg(ll a){return __lg(a);}
ll sq(ll a){return a*a;}
ll gcd(ll a,ll b){return __gcd(a,b);}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}
ll rd(ll l , ll r ){return l+1LL*rand()*rand()%(r-l+1);}
#define prt(a,n) FOR(_i,1,n)cout<<a[_i]<<" ";cout<<el;
#define prv(a) for(auto _v:a)cout<<_v<<" "; cout<<el;
tct bool mini(T& a,T b){return (a>b)?a=b,1:0;}
tct bool maxi(T& a,T b){return (a<b)?a=b,1:0;}
int xx[] = {0,-1,0,1} ;
int yy[] = {-1,0,1,0} ;
const db PI = acos(-1), EPS = 1e-9;
const ll inf = 1e18, cs = 331, sm = 1e9+7;
const int N = 2e5+5, oo = 2e9, LG = __lg(N) + 1;
int n, q;
int a[N], d[N];
// Chia dãy thành các đoạn đồng biến
void init() {
cin >> n >> q;
FOR(i, 1, n) cin >> a[i];
FOR(i, 1, n - 1) d[i] = a[i + 1] - a[i];
}
struct Node {
ll dp[2][2];
int head, tail;
} st[4 * N];
Node merge(Node a, Node b) {
if(a.head == 0) return b;
if(b.head == 0) return a;
Node ans;
ans.dp[0][0] = max({a.dp[0][1] + b.dp[0][0], a.dp[0][0] + b.dp[1][0]});
ans.dp[1][0] = max({a.dp[1][1] + b.dp[0][0], a.dp[1][0] + b.dp[1][0]});
ans.dp[0][1] = max({a.dp[0][1] + b.dp[0][1], a.dp[0][0] + b.dp[1][1]});
ans.dp[1][1] = max({a.dp[1][0] + b.dp[0][1], a.dp[1][1] + b.dp[0][1], a.dp[1][0] + b.dp[1][1]});
if(a.tail == b.head) {
ans.dp[0][0] = max(ans.dp[0][0], a.dp[0][1] + b.dp[1][0]);
ans.dp[0][1] = max(ans.dp[0][1], a.dp[0][1] + b.dp[1][1]);
ans.dp[1][0] = max(ans.dp[1][0], a.dp[1][1] + b.dp[1][0]);
ans.dp[1][1] = max(ans.dp[1][1], a.dp[1][1] + b.dp[1][1]);
}
ans.head = a.head;
ans.tail = b.tail;
return ans;
}
void up(int id, int l, int r, int pos, int val) {
if(pos < l || pos > r)
return;
if(l == r) {
d[l]+= val;
st[id].dp[1][1] = abs(d[l]);
st[id].tail = st[id].head = (d[l] >= 0 ? 1 : - 1);
return;
}
int mid = (l + r) / 2;
up(id << 1, l, mid, pos, val);
up(id << 1 | 1, mid + 1, r, pos, val);
st[id] = merge(st[id << 1], st[id << 1 | 1]);
}
void build(int id, int l, int r) {
if(l == r) {
st[id].dp[1][1] = abs(d[l]);
st[id].tail = st[id].head = (d[l] >= 0 ? 1 : - 1);
return;
}
int mid = (l + r) / 2;
build(id << 1, l, mid);
build(id << 1 | 1, mid + 1, r);
st[id] = merge(st[id << 1], st[id << 1 | 1]);
}
Node get(int id, int l, int r, int u, int v) {
if(l > v || r < u) return {0, 0, 0, 0, 0, 0};
if(l >= u && r <= v) return st[id];
int mid = (l + r) / 2;
return merge(get(id << 1, l, mid, u, v), get(id << 1 | 1, mid + 1, r, u, v));
}
void solve() {
FOR(i, 1, n - 1) up(1, 1, n - 1, i, 0);
while(q--) {
int l, r, x; cin >> l >> r >> x;
up(1, 1, n - 1, l - 1, x);
up(1, 1, n - 1, r, - x);
cout << st[1].dp[1][1] << "\n";
}
}
int32_t main() {
ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);srand(time(0));
if (fopen(Roxy".inp","r")) {
freopen(Roxy".inp","r",stdin);
freopen(Roxy".out","w",stdout);
}
if (mtt) cin>> test;
FOR (i, 1, test) {
init();
solve();
}
cerr<<el<<"TIME : " << 0.001*clock() <<"s"<<el;
}
IyBpbmNsdWRlIDxiaXRzL3N0ZGMrKy5oPgp1c2luZyBuYW1lc3BhY2Ugc3RkOwoKI2RlZmluZSBSb3h5ICJtaW5tYXgiCgpib29sIG10dCA9IDA7CmludCB0ZXN0ID0gMTsKCiNkZWZpbmUgICAgICAgICAgICAgbGwgIGxvbmcgbG9uZwojZGVmaW5lICAgICAgICAgICAgIGRiIGRvdWJsZQojZGVmaW5lICAgICAgICAgICAgIHZlICB2ZWN0b3IKI2RlZmluZSAgICAgICAgICAgICB2aSAgdmVjdG9yPGludD4KI2RlZmluZSAgICAgICAgICAgIHN0ciAgc3RyaW5nCiNkZWZpbmUgICAgICAgICAgICAgcGIgIHB1c2hfYmFjawojZGVmaW5lICAgICAgICAgICAgIGVsICAnXG4nCiNkZWZpbmUgICAgICAgICAgICBwaWkgIHBhaXI8aW50LGludD4KI2RlZmluZSAgICAgICAgICAgIHBsaSAgcGFpcjxsbCxpbnQ+CiNkZWZpbmUgICAgICAgICAgICAgbXAgIG1ha2VfcGFpcgojZGVmaW5lICAgICAgICAgICAgIGZpICBmaXJzdAojZGVmaW5lICAgICAgICAgICAgIHNlICBzZWNvbmQKI2RlZmluZSAgICAgICAgIFVOSShhKSAgc29ydChBTEwoYSkpLGEucmVzaXplKHVuaXF1ZShBTEwoYSkpLWEuYmVnaW4oKSkKI2RlZmluZSAgICAgRk9SKGksYSxiKSAgZm9yKGludCBpPShpbnQpKGEpO2k8PShpbnQpKGIpO2krKykKI2RlZmluZSAgICBGT1JEKGksYSxiKSAgZm9yKGludCBpPShpbnQpKGEpO2k+PShpbnQpKGIpO2ktLSkKI2RlZmluZSAgICBGT1JOK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