#include #include #include using namespace atcoder; using mint = modint1000000007; using namespace std; #define rep(i,n) for (int i = 0; i < (n); ++i) #define Inf 1000000001 int main(){ int N,K; cin>>N>>K; vector a(N); rep(i,N){ cin>>a[i]; } vector t = a; sort(t.begin(),t.end()); t.erase(unique(t.begin(),t.end()),t.end()); rep(i,N){ a[i] = distance(t.begin(),lower_bound(t.begin(),t.end(),a[i])); } string S; cin>>S; vector> F(K+2,fenwick_tree(t.size())); rep(i,N){ for(int j=1;j<=K+1;j++){ if(j==1){ F[j].add(a[i],1); } else{ if(S[j-2]=='>'){ F[j].add(a[i],F[j-1].sum(a[i]+1,t.size())); } else{ F[j].add(a[i],F[j-1].sum(0,a[i])); } } } } cout<