import sys input = sys.stdin.readline from bisect import bisect_left class FenwickTree: def __init__(self, size): self.data = [0] * (size + 1) self.size = size # i is exclusive def prefix_sum(self, i): s = 0 while i > 0: s = (s + self.data[i]) % mod i -= i & -i return s def add(self, i, x): i += 1 while i <= self.size: self.data[i] = (self.data[i] + x) % mod i += i & -i class Compress: def __init__(self, vs): self.xs = list(set(vs)) self.xs.sort() def compress(self, x): return bisect_left(self.xs, x) def decompress(self, i): return self.xs[i] def size(self): return len(self.xs) N, K = map(int, input().split()) A = list(map(int, input().split())) s = input().rstrip() comp = Compress(A) A = [comp.compress(a) for a in A] M = comp.size() mod = 10**9 + 7 dp = [FenwickTree(M) for _ in range(K+1)] for a in A: for k in range(K)[::-1]: if s[k] == '<': c = dp[k].prefix_sum(a) dp[k+1].add(a, c) else: c = dp[k].prefix_sum(M) - dp[k].prefix_sum(a+1) dp[k+1].add(a, c) dp[0].add(a, 1) print(dp[K].prefix_sum(M))