#include using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(nullptr); int N, T; cin >> N >> T; vector t(N); for (int i = 1; i < N; i++) cin >> t[i]; int K; cin >> K; vector f(N); while (K--) { int x; cin >> x; f[x - 1] = true; } int cnt = 0, ans = 0; for (int i = 1; i < N; i++) { if (T > t[i]) { T -= t[i]; } else { int need = (t[i] - T + 10) / 10; if (need > cnt) { cout << -1 << endl; return 0; } cnt -= need; T += 10 * need; T -= t[i]; ans += need; } cnt += f[i]; } cout << (T > 0 ? ans : -1) << endl; }