#include <bits/stdc++.h>
int a[100010] = {0};
int inv[100010] = {0};
int b[100010] = {0};
int c[100010] = {0};
int main() {
  int n, m, k;
  long long res = 0;
  scanf("%d%d%d", &n, &m, &k);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
    inv[a[i]] = i;
    c[a[i]] = (i - 1) / k + 1;
  }
  for (int i = 1; i <= m; i++) {
    scanf("%d", &b[i]);
    res += (long long)c[b[i]];
    if (inv[b[i]] != 1) {
      int temp = c[b[i]];
      c[b[i]] = c[a[inv[b[i]] - 1]];
      c[a[inv[b[i]] - 1]] = temp;
      temp = a[inv[b[i]]];
      a[inv[b[i]]] = a[inv[b[i]] - 1];
      a[inv[b[i]] - 1] = temp;
      inv[a[inv[b[i]]]]++;
      inv[b[i]]--;
    }
  }
  printf("%I64d", res);
  return 0;
}
