from bisect import bisect_left import sys int1 = lambda x: int(x) - 1 # input = lambda: sys.stdin.buffer.readline() input = lambda: sys.stdin.readline().rstrip() ii = lambda: int(input()) i1 = lambda: int1(input()) mi = lambda: map(int, input().split()) mi1 = lambda: map(int1, input().split()) li = lambda: list(mi()) li1 = lambda: list(mi1()) lli = lambda n: [li() for _ in range(n)] INF = float("inf") mod = int(1e9 + 7) # mod = 998244353 class fenwick_tree: n = 1 data = [0 for i in range(n)] def __init__(self, N): self.n = N self.data = [0 for i in range(N)] def add(self, p, x): p += 1 while p <= self.n: self.data[p - 1] += x if self.data[p - 1] >= mod: self.data[p - 1] -= mod p += p & -p def sum(self, l, r): res = self.sum0(r) - self.sum0(l) if res < 0: res += mod return res def sum0(self, r): s = 0 while r > 0: s += self.data[r - 1] if s >= mod: s -= mod r -= r & -r return s n, k = mi() a = li() s = input() std = sorted(list(set(a))) for i in range(len(a)): a[i] = bisect_left(std, a[i]) m = len(std) dp = [[0] * m for _ in range(k + 1)] for i in range(n): p = a[i] + 1 x = 1 while p <= m: dp[0][p - 1] += x if dp[0][p - 1] >= mod: dp[0][p - 1] -= mod p += p & -p for j in range(k): x = 0 if s[j] == "<": r = a[i] while r > 0: x += dp[j][r - 1] if x >= mod: x -= mod r -= r & -r else: r = m while r > 0: x += dp[j][r - 1] if x >= mod: x -= mod r -= r & -r r = a[i] + 1 while r > 0: x -= dp[j][r - 1] if x < 0: x += mod r -= r & -r p = a[i] + 1 while p <= m: dp[j + 1][p - 1] += x if dp[j + 1][p - 1] >= mod: dp[j + 1][p - 1] -= mod p += p & -p x = 0 r = m while r > 0: x += dp[k][r - 1] if x >= mod: x -= mod r -= r & -r print(x)