#include #include #define rep(i, l, n) for (int i = (l); i < (n); i++) #define all(x) x.begin(), x.end() #define lb(a, x) lower_bound(all(a), x) - a.begin() using namespace std; using namespace atcoder; using ll = long long; template using V = vector; template using BIT = fenwick_tree; const ll mod = 1000000007; int main(void) { int N, K; cin >> N >> K; V a(N), b(N); rep(i, 0, N) { cin >> a[i]; } string s; cin >> s; V st = a; sort(all(st)); st.erase(unique(all(st)), st.end()); rep(i, 0, a.size()) { a[i] = lb(st, a[i]); b[i] = st.size() - 1 - a[i]; } V dp(N, 1); rep(i, 0, K) { V ndp(N); BIT bt(N); if (s[i] == '<') { rep(j, 0, N) { ll k = a[j]; bt.add(k, dp[j]); ndp[j] = bt.sum(0, (int)k) % mod; } } else { rep(j, 0, N) { ll k = b[j]; bt.add(k, dp[j]); ndp[j] = bt.sum(0, (int)k) % mod; } } rep(j, 0, N) { dp[j] = ndp[j]; } } ll ans = 0; for (ll t : dp) { ans += t; ans %= mod; } cout << ans << endl; return 0; }