n,p=map(int,input().split())
s=list(map(int,input().split()))
l1=len(s)
d=[0]*(l1+1)
for i in range(1,l1+1):
if i==1:
d[i]=s[0]
else:
d[i]=s[i-1]-s[i-2]
for i in range(0,p):
L,R,value=map(int,input().split())
if R+1<=(len(d)-1):
d[L]+=value
d[R+1]-=value
else:d[L]+=value
min=temp=d[1]
for i in range(2,l1+1):
temp+=d[i]
if temp<=min:
min=temp
print(min)