#include <iostream>
#include <vector>
#include <cmath>
#include <map>
#include <set>
#include <iomanip>
#include <queue>
#include <algorithm>
#include <numeric>
#include <deque>
#include <complex>
#include <cassert>
#include<bits/stdc++.h>
#include<atcoder/all>

using namespace std;
using namespace atcoder;
using ll = long long;
using mint = modint1000000007;

template <typename T>
void compress(vector<T> &A){

    map<T, T> comp;
    int N = A.size(), i=0;
    for (int i=0; i<N; i++) comp[A[i]];

    for (auto &e : comp){
        e.second = i;
        i++;
    }

    for (int i=0; i<N; i++) A[i] = comp[A[i]];
}

int main(){

    ll N, K;
    string S;
    cin >> N >> K;
    vector<ll> A(N);
    for (int i=0; i<N; i++) cin >> A[i];
    cin >> S;
    compress(A);
    vector<fenwick_tree<mint>> dp(K+1, fenwick_tree<mint>(N));

    for (int i=0; i<N; i++){
        for (int j=1; j<=K; j++){
            if (S[j-1] == '<') dp[j].add(A[i], dp[j-1].sum(0, A[i]));
            else dp[j].add(A[i], dp[j-1].sum(A[i]+1, N));
        }
        dp[0].add(A[i], 1);
    }

    cout << dp[K].sum(0, N).val() << endl;

    return 0;
}