#include using namespace std; using Int = long long; template inline bool setmin(T &A, T B){ if (A > B){ A = B; return true; } else { return false; } } template inline bool setmax(T &A, T B){ if (A < B){ A = B; return true; } else { return false; } } #define REP(x, y) for (int x = 0; x < int(y); ++x) #define rep(x, y, z) for (int x = int(y); x < int(z); ++x) #define PER(x, y) for (int x = int(y) - 1; x >= 0; --x) #define per(x, y, z) for (int x = int(z) - 1; x >= int(y); --x) void solve(){ int N, T; cin >> N >> T; vector t(N - 1); REP(i, N - 1){ cin >> t[i]; } int K; cin >> K; vector x(N); REP(i, K){ int xx; cin >> xx; x[--xx] = true; } int ans = 0; int cnt = 0; REP(i, N - 1){ T -= t[i]; if (T <= 0){ int need = -T / 10 + 1; if (cnt < need){ cout << -1 << '\n'; return; } T += need * 10; ans += need; cnt -= need; } if (x[i + 1]){ ++cnt; } } cout << ans << '\n'; } int main(){ ios::sync_with_stdio(false); cin.tie(nullptr); int t = 1; // cin >> t; while (t--){ solve(); } }