import java.io.*; import java.util.*; public class Main { static final int MOD = 1000000007; static ArrayList>> dp = new ArrayList<>(); static int[] values; static boolean[] isLower; public static void main(String[] args) throws Exception { Scanner sc = new Scanner(); int n = sc.nextInt(); int k = sc.nextInt(); values = new int[n]; for (int i = 0; i < n; i++) { values[i] = sc.nextInt(); } char[] string = (sc.next() + "<").toCharArray(); isLower = new boolean[k + 1]; for (int i = 0; i <= k; i++) { isLower[i] = (string[i] == '<'); dp.add(new HashMap<>()); } System.out.println(dfw(k, n - 1, Integer.MAX_VALUE)); } static int dfw(int idx, int count, int v) { if (count < idx) { return 0; } if (idx < 0) { return 1; } if (!dp.get(idx).containsKey(count)) { dp.get(idx).put(count, new HashMap<>()); } if (!dp.get(idx).get(count).containsKey(v)) { int ans = dfw(idx, count - 1, v); if (isLower[idx]) { if (values[count] < v) { ans += dfw(idx - 1, count - 1, values[count]); ans %= MOD; } } else { if (values[count] > v) { ans += dfw(idx - 1, count - 1, values[count]); ans %= MOD; } } dp.get(idx).get(count).put(v, ans); } return dp.get(idx).get(count).get(v); } } class Scanner { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer st = new StringTokenizer(""); public Scanner() throws Exception { } public int nextInt() throws Exception { return Integer.parseInt(next()); } public long nextLong() throws Exception { return Long.parseLong(next()); } public double nextDouble() throws Exception { return Double.parseDouble(next()); } public String next() throws Exception { if (!st.hasMoreTokens()) { st = new StringTokenizer(br.readLine()); } return st.nextToken(); } }