#include <bits/stdc++.h>
using namespace std;
long long mod = 998244353;
long long powmod(long long a, long long b) {
  long long res = 1;
  a %= mod;
  assert(b >= 0);
  for (; b; b >>= 1) {
    if (b & 1) res = res * a % mod;
    a = a * a % mod;
  }
  return res;
}
const int maxn = 2e5 + 10;
char a[maxn];
int dp[maxn];
int n, m;
long long ans;
int G[maxn], tmp[maxn];
int main() {
  scanf("%d%d", &n, &m);
  scanf("%s", a);
  int num = 0;
  for (int i = 0; i < n; ++i) {
    if (a[i] == '1') G[num++] = i;
  }
  for (int i = 0; i < m; ++i) scanf("%1d", &tmp[i]);
  for (int i = 1; i < m; ++i) tmp[i] += tmp[i - 1];
  int cnt = 1;
  for (int i = m - 1; i >= 0; --i) {
    if (n - cnt < 0) break;
    dp[n - cnt] = tmp[i];
    cnt++;
  }
  for (int i = 0; i < num; ++i) {
    ans = (ans + (powmod(2, n - G[i] - 1) * (dp[G[i]] % mod)) % mod) % mod;
  }
  printf("%lld\n", ans);
  return 0;
}
