#include <bits/stdc++.h>
using namespace std;
int s[100005], rev[100005];
int main() {
  int n, m, k, b;
  long long count = 0;
  scanf("%d %d %d", &n, &m, &k);
  for (int i = 0; i < n; i++) {
    scanf("%d", &s[i]);
    rev[s[i]] = i;
  }
  for (int i = 0; i < m; i++) {
    scanf("%d", &b);
    count += rev[b] / k + 1;
    if (rev[b] != 0) {
      swap(s[rev[b]], s[rev[b] - 1]);
      rev[b]--;
      rev[s[rev[b] + 1]]++;
    }
  }
  printf("%I64d\n", count);
  return 0;
}
