#include <bits/stdc++.h>
using namespace std;
int xx[4] = {0, 0, 1, -1};
int yy[4] = {-1, 1, 0, 0};
int main() {
  long long n, m, k;
  scanf("%lld %lld %lld", &n, &m, &k);
  vector<long long> v(n + 1);
  map<long long, long long> mp;
  for (int i = 1; i <= n; i++) {
    long long x;
    scanf("%lld", &x);
    v[i] = x;
    mp[x] = i;
  }
  long long res = 0;
  while (m--) {
    long long x;
    cin >> x;
    long long q = ceil(mp[x] / (double)k);
    q--;
    res += q + 1;
    if (mp[x] != 1) {
      long long a = v[mp[x]];
      long long b = v[mp[x] - 1];
      swap(v[mp[x]], v[mp[x] - 1]);
      long long i = mp[x];
      mp[b] = i;
      mp[a] = i - 1;
    }
  }
  cout << res << endl;
}
