#include <bits/stdc++.h>
using namespace std;
int arr[100006];
int n, m, k;
map<int, int> mp;
int main() {
  int x;
  scanf("%d%d%d", &n, &m, &k);
  for (int i = 0; i < n; ++i) {
    scanf("%d", arr + i);
    mp[arr[i]] = i;
  }
  long long ans = 0;
  for (int i = 1; i <= m; ++i) {
    scanf("%d", &x);
    int j = mp[x];
    if (j) {
      swap(arr[j], arr[j - 1]);
      mp[arr[j]] = j;
      mp[arr[j - 1]] = j - 1;
    }
    ans += j / k + 1;
  }
  printf("%I64d", ans);
  return 0;
}
