#include <bits/stdc++.h>
using namespace std;
vector<long long> vec;
map<long long, long long> x;
vector<long long> y;
int main() {
  long long n, m, k;
  cin >> n >> m >> k;
  vec = vector<long long>(n);
  y = vector<long long>(n + 1);
  for (long long i = 0; i < n; ++i) {
    cin >> vec[i];
    x[vec[i]] = i;
    y[i] = vec[i];
  }
  long long cont = 0, q;
  for (long long i = 0; i < m; ++i) {
    cin >> q;
    long long pos = x[q];
    long long screen = pos / k;
    cont += (screen + 1);
    if (pos != 0) {
      long long posAnterior = pos - 1;
      long long numAnterior = y[pos - 1];
      long long numActual = q;
      long long posActual = pos;
      y[posAnterior] = numActual;
      y[posActual] = numAnterior;
      x[numActual] = posAnterior;
      x[numAnterior] = posActual;
    }
  }
  cout << cont << endl;
  return 0;
}
