#include <bits/stdc++.h>
using namespace std;
void show() { cout << '\n'; }
template <typename T, typename... Args>
void show(T a, Args... args) {
  cout << a << " ";
  show(args...);
}
template <typename T>
void show_c(T& a) {
  for (auto& x : a) {
    cout << x << " ";
  }
  cout << endl;
}
int arr[100100];
int ind[100100];
int main() {
  int n, m, k;
  scanf("%d %d %d", &n, &m, &k);
  for (int i = 0; i < n; ++i) {
    scanf("%d", &arr[i]);
    ind[arr[i]] = i;
  }
  int id;
  long long sum = 0;
  while (m--) {
    scanf("%d", &id);
    sum += ind[id] / k + 1;
    if (ind[id] != 0) {
      int tmp = ind[id];
      swap(arr[tmp], arr[tmp - 1]);
      ind[arr[tmp]] = tmp;
      ind[arr[tmp - 1]] = tmp - 1;
    }
  }
  cout << sum << endl;
  return 0;
}
