#include using namespace std; using ll=long long; using ull=unsigned long long; constexpr int MOD=998244353; #define rep(i,n) for(int i=0;i<(int)(n);i++) #define rep2(i,l,r) for(int i=(l);i<(int)(r);i++) #define all(v) v.begin(),v.end() int main(){ ios::sync_with_stdio(false); cin.tie(nullptr); int Q; ll Y; cin>>Q>>Y; vector A(Q); for(auto &i:A)cin>>i; auto f=[A](ll X){ stack> a; for(auto i:A){ if(i=="max"){ ll x=a.top(); a.pop(); ll y=a.top(); a.pop(); a.push(max(x,y)); }else if(i=="min"){ ll x=a.top(); a.pop(); ll y=a.top(); a.pop(); a.push(min(x,y)); }else if(i=="+"){ ll x=a.top(); a.pop(); ll y=a.top(); a.pop(); a.push(x+y); }else if(i=="X"){ a.push(X); }else{ a.push(stoll(i)); } } return a.top(); }; ll ng=-1,ok=Y; while(ok-ng>1){ ll mid=(ok+ng)/2; if(f(mid)>=Y)ok=mid; else ng=mid; } if(f(ok)==Y)cout<