#include<bits/stdc++.h> using namespace std; int a[210],b[210]; int n,m; int main() { cin>>n>>m; for(int i=1;i<=n;i++){ cin>>a[i]; } while(m--) { int l,r,z; cin>>l>>r>>z; b[l]+=z; b[r+1]-=z; } int ans=9999999; for(int i=1;i<=n;i++){ b[i]+=b[i-1]; a[i]+=b[i]; ans=min(ans,a[i]); } cout<<ans; return 0; }