#include <bits/stdc++.h>
int arr[100001], hash[100001];
int main() {
  int n, m, k;
  while (scanf("%d %d %d", &n, &m, &k) != EOF) {
    for (int i = 1; i <= n; i++) {
      scanf("%d", &arr[i]);
      hash[arr[i]] = i;
    }
    long long swaps = 0;
    for (int i = 0; i < m; i++) {
      int num;
      scanf("%d", &num);
      int pos = hash[num];
      int k1 = pos;
      if (k1 % k)
        k1 = k1 / k + 1;
      else
        k1 = k1 / k;
      swaps += k1;
      if (pos > 1) {
        hash[num] = pos - 1;
        hash[arr[pos - 1]] = pos;
        arr[pos] = arr[pos - 1];
        arr[pos - 1] = num;
      }
    }
    printf("%I64d\n", swaps);
  }
}
