#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, k;
  cin >> n >> m >> k;
  int i;
  int arr[100005], pos[100005];
  for (i = 1; i <= n; ++i) {
    cin >> arr[i];
    pos[arr[i]] = i;
  }
  long long t = 0;
  while (m--) {
    int icon;
    cin >> icon;
    int posi = pos[icon];
    t += (long long)((posi - 1) / k);
    t++;
    if (posi != 1) {
      pos[icon] = posi - 1;
      pos[arr[posi - 1]] = posi;
      int temp = arr[posi];
      arr[posi] = arr[posi - 1];
      arr[posi - 1] = temp;
    }
  }
  cout << t << endl;
  return 0;
}
