import itertools as iter import collections as coll import heapq as hq import bisect as bis from decimal import Decimal as dec from functools import cmp_to_key import math import sys #import pypyjit #pypyjit.set_param('max_unroll_recursion=-1') sys.setrecursionlimit(10 ** 6) inp = sys.stdin.readline input = lambda : inp().rstrip() getN = lambda : int(inp()) getNs = lambda : map(int, inp().split()) getList = lambda :list(map(int, inp().split())) getStrs = lambda n : [input() for _ in [0] * n] def yexit(): print("Yes"); exit(0) def nexit(): print("No"); exit(0) pi = 3.141592653589793 mod = 1000000007 MOD = 998244353 INF = 4611686018427387903 dx = [1, 0, -1, 0]; dy = [0, 1, 0, -1] 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, _ = getNs() a = getList() s = input() d = {} for i, k in enumerate(sorted(set(a))): d[k] = i b = [0] * n for i, k in enumerate(a): a[i] = d[k] b[i] = n - 1 - a[i] dp = [1] * n for c in s: lis = a if(c == '<') else b ndp = [0] * n bt = BIT(n) for i, k in enumerate(lis): ndp[i] = bt.sum(k) % mod bt.add(k, dp[i]) dp = ndp[:] ans = 0 for k in dp: ans += k ans %= mod print(ans)