#include using namespace std; int main() { int N, T, K; cin >> N >> T; assert(2 < N && N <= (int)2e5 && 0 < T && T <= (int)4e6); vector t(N - 1, 0), sum(N, 0); for(int i = 1; i < N; i++) { cin >> t.at(i - 1); sum.at(i) = sum.at(i - 1) + t.at(i - 1); assert(0 < t.at(i - 1) && t.at(i - 1) < 21); } cin >> K; assert(0 < K && K < N - 1); int x_max = 0; vector x(K, 0); for(int &o : x) { cin >> o; assert(x_max < o && 1 < o && o < N); x_max = o, o--; } bool f = false; int tmp = T; for(int i = 0; i < K; i++) { if(tmp + 10 * i <= sum.at(x.at(i))) { f = true; } } if(f) { cout << -1 << endl; return 0; } int l = -1, r = K, c = 0; while(r - l > 1) { c = (l + r) / 2; if(tmp + 10 * c <= sum.at(N - 1)) { l = c; } else { r = c; } } cout << r << endl; }