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 = [[0] * N for _ in [0] * (K + 1)] dp[0] = [1] * N for i in range(1, K + 1): c = s[i - 1] bt = BIT(N) if(c == 1): for j, k in enumerate(a): bt.add(k, dp[i - 1][j]) dp[i][j] = bt.sum(k) % mod else: for j, k in enumerate(b): bt.add(k, dp[i - 1][j]) dp[i][j] = bt.sum(k) % mod ans = 0 for t in dp[K]: ans += t ans %= mod print(ans)