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): assert 0 <= p < self.n, "0<=p= mod: self.data[p - 1] -= mod p += p & -p def sum(self, l, r): assert 0 <= l and l <= r and r <= self.n, "0<=l<=r<=n,l={0},r={1},n={2}".format( l, r, self.n ) 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 = [fenwick_tree(m) for _ in range(k + 1)] for i in range(n): dp[0].add(a[i], 1) for j in range(k): if s[j] == "<": dp[j + 1].add(a[i], dp[j].sum(0, a[i])) else: dp[j + 1].add(a[i], dp[j].sum(a[i] + 1, m)) print(dp[k].sum(0, m))