#include <bits/stdc++.h>
using namespace std;
int n, m, k, x;
int a[100009], b[100009], q[100009];
long long ans;
int main() {
  scanf("%d%d%d", &n, &m, &k);
  for (int i = 1; i <= n; i++) scanf("%d", a + i), b[a[i]] = i;
  for (int i = 1; i <= m; i++) scanf("%d", q + i);
  for (int i = 1; i <= m; i++) {
    ans += b[q[i]] / k;
    if (b[q[i]] % k) ans++;
    if (b[q[i]] != 1) {
      int tmp = b[q[i]];
      swap(a[tmp], a[tmp - 1]);
      b[a[tmp]] = tmp, b[a[tmp - 1]] = tmp - 1;
    }
  }
  cout << ans;
  return 0;
}
