import java.util.*; class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int k = sc.nextInt(); int T = sc.nextInt(); int[] toy=new int[k]; for (int i = 0; i < k; i++) { toy[i]= sc.nextInt(); } int res=0; PriorityQueue<Integer> pq=new PriorityQueue<>(); for (int i = 0; i < n; i++) { int x=sc.nextInt(); if(pq.size()==0&&x==0){ res+=T; }else if(x>0&&x-1<k&&toy[x-1]<T){//key point pq.add(toy[x-1]); }else if(x==0){ res+=pq.poll(); } } System.out.println(res); } }