#include <bits/stdc++.h>
using namespace std;
ifstream f("test.in");
const int NMAX = 100000 + 1;
int n, m, k;
int poz[NMAX], app[NMAX];
void citeste() {
  cin >> n >> m >> k;
  int x;
  for (int i = 1; i <= n; i++) {
    cin >> x;
    poz[x] = i;
    app[i] = x;
  }
}
void rezolva() {
  int x, ecran, ant;
  long long sol = 0;
  for (int i = 1; i <= m; i++) {
    cin >> x;
    ecran = poz[x] / k;
    if (poz[x] % k) ecran++;
    sol = sol + ecran;
    if (poz[x] != 1) {
      ant = app[poz[x] - 1];
      poz[x]--;
      poz[ant]++;
      app[poz[x]] = x;
      app[poz[ant]] = ant;
    }
  }
  cout << sol;
}
int main() {
  citeste();
  rezolva();
}
