#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, m, k, x;
  cin >> n >> m >> k;
  long long i;
  long long a[n];
  map<long long, long long> mp;
  for (i = 1; i <= n; i++) {
    cin >> a[i];
    mp[a[i]] = i;
  }
  long long ans = 0;
  for (i = 0; i < m; i++) {
    cin >> x;
    long long indx = mp[x];
    ans += ceil(1.0 * mp[x] / k) - 1;
    ans++;
    if (mp[x] != 1) {
      swap(a[indx - 1], a[indx]);
      mp[a[indx - 1]] = indx - 1;
      mp[a[indx]] = indx;
    }
  }
  cout << ans << "\n";
}
