#include <bits/stdc++.h>
using namespace std;
constexpr int N = 301, mod = 998244353;
uint64_t dp[N][N][N]{1};
int main() {
int n, m; cin >> n >> m;
string s; cin >> s;
vector<int> a(m);
for (auto& a: a) cin >> a;
for (int i = 0, d = 0; i < n + m; d += s[i++] == '-')
for (int l = d + 1; l--; ) if (s[i] == '+') {
for (int c = i - d + 1; c-- > d; )
for (int t = 0; t <= c - l; ++t) (dp[l][c + 1][t + 1] += exchange(dp[l][c][t], dp[l][c][t] * max(0, n - (l == m? 0: a[m - 1 - l]) - l - i + d + c) % mod)) %= mod;
} else {
for (auto j = 1ull, A = j; j <= d + 1 - l; (A *= d + 1 - l - j++) % mod)
for (auto t = 1ull; t <= d + 1 - l; ++t) (dp[l + j][d + 1][0] += t * A % mod * dp[l][d + 1][t]) %= mod;
for (int t = 1; t <= d + 1 - l; ++t) (dp[l][d + 1][0] += exchange(dp[l][d + 1][t], 0)) %= mod;
}
cout << dp[m][m][0];
}