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 = 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, c in enumerate(s, 1): bt = BIT(N) lis = a if(c == '<') else b for j, k in enumerate(lis): 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)