#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, k, temp;
  int a[100002], p[100002];
  int x;
  int i;
  long long ans = 0;
  scanf("%d %d %d", &n, &m, &k);
  for (i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
    p[a[i]] = i;
  }
  while (m--) {
    scanf("%d", &x);
    ans++;
    ans += ((p[x] - 1) / k);
    if (p[x] != 1) {
      temp = a[p[x]];
      a[p[x]] = a[p[x] - 1];
      a[p[x] - 1] = temp;
      p[a[p[x]]]++;
      p[a[p[x] - 1]]--;
    }
  }
  printf("%lld", ans);
  return 0;
}
