#include <bits/stdc++.h>
using namespace std;
const int MAX = 100009;
int n, m, k, a[MAX], b[MAX], pos[MAX];
int main() {
  cin >> n >> m >> k;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
    pos[a[i]] = i;
  }
  long long ans = 0;
  for (int i = 1; i <= m; i++) {
    cin >> b[i];
    int current = pos[b[i]];
    ans += (current + k - 1) / k;
    if (current > 1) {
      swap(pos[a[current]], pos[a[current - 1]]);
      swap(a[current], a[current - 1]);
    }
  }
  printf("%I64d\n", ans);
  return 0;
}
