#include <bits/stdc++.h>
using namespace std;
vector<int> v[100002];
int scr[100002];
int idx[100002];
int main() {
  int n, m, k;
  scanf("%d", &n);
  scanf("%d", &m);
  scanf("%d", &k);
  int ind = 0;
  int cnt = 0;
  int val = (n / k) + (n % k ? 1 : 0);
  for (int i = 0; i < n; i++) {
    int x;
    scanf("%d", &x);
    v[ind].push_back(x);
    cnt++;
    if (cnt == k) cnt = 0, ind++;
  }
  for (int i = 0; i < val; i++) {
    for (int j = 0; j < v[i].size(); j++) {
      scr[v[i][j]] = i;
      idx[v[i][j]] = j;
    }
  }
  long long int ans = 0;
  for (int i = 0; i < m; i++) {
    int x;
    scanf("%d", &x);
    int sc = scr[x];
    int id = idx[x];
    if (id > 0) {
      int t1 = v[sc][id];
      int t2 = v[sc][id - 1];
      v[sc][id] = t2;
      idx[t2] = id;
      v[sc][id - 1] = t1;
      idx[t1] = id - 1;
    } else {
      if (sc > 0) {
        int t1 = v[sc][id];
        int t2 = v[sc - 1][k - 1];
        v[sc][id] = t2;
        v[sc - 1][k - 1] = t1;
        scr[t2] = sc;
        idx[t2] = id;
        scr[t1] = sc - 1;
        idx[t1] = k - 1;
      }
    }
    ans += (sc + 1);
  }
  printf("%I64d\n", ans);
  return 0;
}
