import std; void main () { int N, T; readln.read(N, T); auto t = readln.split.to!(int[]); int K = readln.chomp.to!int; auto x = readln.split.to!(int[]); // 貪欲に前からとってよい int tsum = sum(t); int need = (max(tsum + 1 - T, 0) + 10 - 1) / 10; int ans = need; bool[int] mp; foreach (v; x) mp[v] = true; bool ok = true; int cur = T; foreach (i; 0 .. N - 1) { if (cur - t[i] <= 0) ok = false; cur -= t[i]; if (i + 2 in mp) { if (0 < need) { need--; cur += 10; } } } if (ok) { writeln(ans); } else { writeln(-1); } } void read (T...) (string S, ref T args) { import std.conv : to; import std.array : split; auto buf = S.split; foreach (i, ref arg; args) { arg = buf[i].to!(typeof(arg)); } }