import sys input = lambda: sys.stdin.readline().rstrip() ii = lambda: int(input()) mi = lambda: map(int, input().split()) li = lambda: list(mi()) INF = 2 ** 63 - 1 mod = 10 ** 9 + 7 n, k = mi() a = li() s = input() upgraph = [[] for _ in range(n)] downgraph = [[] for _ in range(n)] for i in range(n): for j in range(i + 1, n): if a[i] < a[j]: upgraph[i].append(j) elif a[i] > a[j]: downgraph[i].append(j) dp = [[0] * (k + 1) for _ in range(n + 1)] for i in range(n): dp[i][0] = 1 for i in range(n): for j in range(max(0, k - (n - i)), k): if s[j] == '<': for to in upgraph[i]: dp[to][j + 1] += dp[i][j] dp[to][j + 1] %= mod elif s[j] == '>': for to in downgraph[i]: dp[to][j + 1] += dp[i][j] dp[to][j + 1] %= mod ans = 0 for i in range(n): ans += dp[i][k] ans %= mod print(ans)