class Bit: #0-indexed def __init__(self, n): self.size = n self.tree = [0] * (n + 1) def sum(self, i): i += 1 s = 0 while i > 0: s += self.tree[i] i -= i & -i return s def add(self, i, x): i += 1 while i <= self.size: self.tree[i] += x i += i & -i MOD = 10 ** 9 + 7 compress = lambda arr: {e: i for i, e in enumerate(sorted(set(arr)))} n, k = map(int, input().split()) a = list(map(int, input().split())) s = input() cp = compress(a) for i in range(n): a[i] = cp[a[i]] fw = [Bit(n) for _ in range(k + 1)] for i in range(n): for j in range(k, 0, -1): if s[j - 1] == '<': fw[j].add(a[i], fw[j - 1].sum(a[i] - 1) % MOD) else: fw[j].add(a[i], (fw[j - 1].sum(n - 1) - fw[j - 1].sum(a[i])) % MOD) fw[0].add(a[i], 1) print(fw[k].sum(n - 1) % MOD)