n, t = map(int, input().split()) a = list(map(int, input().split())) itm = [0] * n input() for x in map(int, input().split()): itm[x - 1] = 1 now = 0 ans = 0 for i in range(n - 1): # 10*use+t > ti # use>(ti-t)/10 now += itm[i] use = max(0, (a[i] - t) // 10 + 1) if use > now: ans = -1 break ans += use now -= use t += 10 * use t -= a[i] print(ans)