Y=int(input().split()[1]) S=input().split() def f(x): A=[] for s in S: if"0">s:a=A.pop();A[-1]+=a elif"m">s:A+=[int(s)if"X">s else x] else:A[-2]=[min,max]["mi">s](A[-2:]);A.pop() return A[0] l,r=-1,Y while l>1 if f(m)Y])