import sys input = sys.stdin.readline mod = 10 ** 9 + 7 class BIT: def __init__(self, n): self.size = n self.bit = [0] * (n + 1) def add(self, k, p): t = k + 1 while(t <= self.size): self.bit[t] += p self.bit[t] %= mod t += t & -t def sum(self, r): res, t = 0, r while(t > 0): res += self.bit[t] res %= mod t -= t & -t return res """ Main Code """ N, K = map(int, input().split()) a = list(map(int, input().split())) s = [1 if(c == '<') else 0 for c in input().rstrip()] lis = sorted(set(a)) d = {} for i, k in enumerate(lis): d[k] = i for i in range(N): a[i] = d[a[i]] b = [len(lis) - 1 - i for i in a] dp = [1] * N for c in s: ndp = [0] * N bt = BIT(N) if(c == 1): for i, k in enumerate(a): bt.add(k, dp[i]) ndp[i] = bt.sum(k) ndp[i] %= mod else: for i, k in enumerate(b): bt.add(k, dp[i]) ndp[i] = bt.sum(k) ndp[i] %= mod dp = ndp[:] ans = 0 for t in dp: ans += t ans %= mod print(ans)