#include<bits/stdc++.h>
using namespace std;
const int N =1e5+10;
inline int read(){
char ch = getchar(); int x = 0;
while (!isdigit(ch)) ch = getchar();
while (isdigit(ch)) x = x*10+ch-'0', ch = getchar();
return x;
}
struct Sort{
int op,l,r;
}s[N<<1];
int n,m,a[N],q;
struct SegTree{
int l,r,sum,tag;
#define lson(p) (p<<1)
#define rson(p) (p<<1|1)
}t[N<<2];
void push_up(int p){
t[p].sum=t[lson(p)].sum+t[rson(p)].sum;
}
void change(int k,int p){
if(k==1) t[p].sum=t[p].r-t[p].l+1,t[p].tag=1;
else if(k==-1) t[p].sum=0,t[p].tag=-1;
else t[p].tag=t[p].tag;
}
void push_down(int p){
change(t[p].tag,lson(p));
change(t[p].tag,rson(p));
t[p].tag=0;
}
void build_tree(int p,int l,int r,int x){
t[p].l=l,t[p].r=r,t[p].tag=0;
if(l==r){
t[p].sum=a[l]>=x;
return ;
}
int mid=(l+r)>>1;
build_tree(lson(p),l,mid,x);
build_tree(rson(p),mid+1,r,x);
push_up(p);
}
inline int query(int p,int l,int r){
if(t[p].r<l or t[p].l>r) return 0;
if(l<=t[p].l and t[p].r<=r) return t[p].sum;
push_down(p);
return query(lson(p),l,r)+query(rson(p),l,r);
}
inline void update(int p,int l,int r,int v){
if(l>r) return;
if(t[p].r<l or t[p].l>r) return ;
if(l<=t[p].l and t[p].r<=r){
t[p].sum=v*(r-l+1);
t[p].tag=v?1:-1;
return ;
}
push_down(p);
update(lson(p),l,r,v);
update(rson(p),l,r,v);
push_up(p);
}
inline bool check(int k){
memset(t,0,sizeof(t));
build_tree(1,1,n,k);
for(int i=1;i<=m;i++){
int cnt=query(1,s[i].l,s[i].r);
if(s[i].op==0){
update(1,s[i].r-cnt+1,s[i].r,1);
update(1,s[i].l,s[i].r-cnt,0);
}
else{
update(1,s[i].l,s[i].l+cnt-1,1);
update(1,s[i].l+cnt,s[i].r,0);
}
}
return query(1,q,q);
}
int main(){
int op,l,r;
n=read(),m=read();
for(int i=1;i<=n;i++) a[i]=read();
for(int i=1;i<=m;i++) op=read(),l=read(),r=read(),s[i]={op,l,r};
q=read();
l=1,r=n;
int mid,ans;
while(l<=r){
mid=(l+r)>>1;
if(check(mid)) ans=mid,l=mid+1;
else r=mid-1;
}
printf("%d",ans);
return 0;
}