#pragma GCC target("avx2") #pragma GCC optimize("O3") #pragma GCC optimize("unroll-loops") #include #include using namespace std; using namespace atcoder; using ll=long long; void IO(){ ios::sync_with_stdio(false); std::cin.tie(nullptr); } int main(){ IO(); ll n,m; cin>>n>>m; vector l(n+2); l[0]=-1e18; for(ll i=1;i<=n;i++){ cin>>l[i]; } l[n+1]=1e18; vector f(m),b(m),w(m); for(ll i=0;i>f[i]>>b[i]>>w[i]; } ll ans=0; for(ll i=0;i