Example

Input

6 3
1 0 0 1 0 1
1 3 2


Output

1
//#define __USE_MINGW_ANSI_STDIO 0
#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VL;
typedef vector<VL> VVL;
typedef pair<int, int> PII;

#define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) x.begin(), x.end()
#define MP make_pair
#define PB push_back
#define MOD 1000000007
#define INF (1LL << 30)
#define LLINF (1LL << 60)
#define PI 3.14159265359
#define EPS 1e-12
//#define int ll

int a[20], acnt[2], aa[20], b[20], bcnt[2], p[20], c[20], ccnt[2];
signed main(void) {
  int n, m;
  cin >> n >> m;
  REP(i, n) {
    cin >> a[i];
		aa[i] = a[i];
    acnt[a[i]]++;
  }
  REP(i, m) cin >> p[i];

	int cnt = 0, t1 = 0, t2 = 1;
  REP(i, m) {
    REP(j, p[i]) {
			//cout << cnt << " " << t1 << " " << t2 << endl;
      b[cnt] = t1;
      c[cnt] = t2;
      cnt++;
      bcnt[t1]++;
      ccnt[t2]++;
    }
    swap(t1, t2);
  }

	//REP(i, n) cout << b[i] << " "; cout << endl;
	//REP(i, n) cout << c[i] << " "; cout << endl;

  int ret1 = INF;
  if (bcnt[0] == acnt[0] && bcnt[1] == acnt[1]) {
		ret1 = 0;
    REP(i, n) {
      if (aa[i] != b[i]) {
        int idx = i;
        while (aa[idx] == aa[i])
          idx++;
        for (int j = idx; j > i; --j) {
          swap(aa[j], aa[j - 1]);
          ret1++;
        }
      }
    }
  }

	int ret2 = INF;
	if (ccnt[0] == acnt[0] && ccnt[1] == acnt[1]) {
		ret2 = 0;
    REP(i, n) {
      if (a[i] != c[i]) {
        int idx = i;
        while (a[idx] == a[i])
          idx++;
        for (int j = idx; j > i; --j) {
          swap(a[j], a[j - 1]);
          ret2++;
        }
      }
    }
  }
	//REP(i, n) cout << aa[i] << " "; cout << endl;
	//REP(i, n) cout << a[i] << " "; cout << endl;

	//cout << ret1 << " " << ret2 << endl;
	cout << min(ret1, ret2) << endl;

  return 0;
}