#include<map>
#include<set>
#include<cmath>
#include<queue>
#include<bitset>
#include<math.h>
#include<cstdio>
#include<vector>
#include<string>
#include<cstring>
#include<iostream>
#include<algorithm>
#pragma comment(linker, "/STACK:102400000,102400000")
using namespace std;
const int N=300010;
const int MAX=1000000100;
const int mod=9973;
const double EPS=0.00000001;
typedef long long ll;
const ll MOD=100000000;
const ll MOD1=104857601;
const ll MOD2=23068673;
const int INF=1000000010;
typedef double db;
typedef long double ldb;
typedef unsigned long long ull;
struct node {
int l,r;
ll x;
}ope[N];
ll f[N],p[N];
int m,x[N],y[N],q[N],ans[N];
int tot,u[N],v[N],pre[N];
void add_b(int a,int b) {
v[tot]=b;pre[tot]=u[a];u[a]=tot++;
}
void add_x(int a,ll b) {
for (;a<=m;a+=a&-a) f[a]+=b;
}
ll getsum(int a) {
ll ret=0;
for (;a;a-=a&-a) ret+=f[a];
return ret;
}
void updata(int l,int r,ll x,int v) {
if (l<=r) {
add_x(l,v*x);add_x(r+1,-1*v*x);
} else {
add_x(l,v*x);add_x(1,v*x);add_x(r+1,-1*v*x);
}
}
void div(int l,int r,int L,int R) {
if (L>R) return ;
ll sum;
if (l==r) {
updata(ope[l].l,ope[l].r,ope[l].x,1);
for (int i=L;i<=R;i++) {
sum=0;
for (int j=u[x[i]];j!=-1;j=pre[j]) {
sum+=getsum(v[j]);if (sum>=p[x[i]]) break ;
}
if (sum>=p[x[i]]) ans[x[i]]=l;
else ans[x[i]]=-1;
}
updata(ope[l].l,ope[l].r,ope[l].x,-1);
return ;
}
int i,j,g,k=L,mid=(l+r)>>1;
for (i=l;i<=mid;i++) updata(ope[i].l,ope[i].r,ope[i].x,1);
for (i=L;i<=R;i++) {
sum=0;
for (j=u[x[i]];j!=-1;j=pre[j]) {
sum+=getsum(v[j]);if (sum>=p[x[i]]) break ;
}
if (sum>=p[x[i]]) { y[k++]=x[i];q[i]=1; }
}
g=k;
for (i=L;i<=R;i++)
if (!q[i]) y[k++]=x[i];
for (i=L;i<=R;i++) x[i]=y[i],q[i]=0;
div(mid+1,r,g,R);
for (i=l;i<=mid;i++) updata(ope[i].l,ope[i].r,ope[i].x,-1);
div(l,mid,L,g-1);
}
int main()
{
int i,k,n,o;
scanf("%d%d", &n, &m);
tot=0;memset(u,-1,sizeof(u));
for (i=1;i<=m;i++) {
scanf("%d", &o);add_b(o,i);
}
for (i=1;i<=n;i++) scanf("%lld", &p[i]);
scanf("%d", &k);
for (i=1;i<=k;i++) scanf("%d%d%lld", &ope[i].l, &ope[i].r, &ope[i].x);
for (i=1;i<=n;i++) x[i]=i;
memset(f,0,sizeof(f));
div(1,k,1,n);
for (i=1;i<=n;i++)
if (ans[i]==-1) printf("NIE\n");
else printf("%d\n", ans[i]);
return 0;
}