#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, p, cnt = 0, in = 1, app, tmp;
  int page[100005], ara[100005], pos[100005];
  scanf("%d %d %d", &n, &m, &p);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &tmp);
    ara[i] = tmp;
    pos[tmp] = i;
    page[tmp] = in;
    cnt++;
    if (cnt == p) {
      cnt = 0;
      in++;
    }
  }
  long long int apos, ans = 0;
  for (int j = 0; j < m; j++) {
    scanf("%d", &app);
    ans += page[app];
    apos = pos[app];
    if (apos != 1) {
      swap(ara[apos], ara[apos - 1]);
      swap(pos[ara[apos]], pos[ara[apos - 1]]);
      swap(page[ara[apos]], page[ara[apos - 1]]);
    }
  }
  printf("%I64d\n", ans);
  return 0;
}
