#include <bits/stdc++.h>
using namespace std;
int pos[200010], par[200010];
int main() {
  int n, m, k, v;
  while (scanf("%d%d%d", &n, &m, &k) != EOF) {
    for (int i = 1; i < n + 1; ++i) {
      scanf("%d", &v);
      pos[v] = i;
      par[i] = v;
    }
    long long ans = 0;
    for (int i = 0; i < m; ++i) {
      scanf("%d", &v);
      ans += ((pos[v] - 1) / k) + 1;
      if (pos[v] != 1) {
        int pv = pos[v];
        swap(par[pv], par[pv - 1]);
        pos[par[pv]] = pv;
        pos[par[pv - 1]] = pv - 1;
      }
    }
    printf("%I64d\n", ans);
  }
  return 0;
}
