#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long n, m, k, idx, res = 0;
  cin >> n >> m >> k;
  vector<long long> v1(n), v2(m);
  map<long long, long long> mp;
  for (auto &x : v1) cin >> x;
  ;
  for (auto &x : v2) cin >> x;
  ;
  for (long long i = 0; i < n; ++i) mp[v1[i]] = i;
  for (long long i = 0; i < m; ++i) {
    auto it = mp.find(v2[i]);
    idx = it->second;
    res += (idx / k + 1);
    mp[v1[max(idx - 1, 0LL)]] = idx;
    mp[v1[idx]] = max(idx - 1, 0LL);
    swap(v1[idx], v1[max(idx - 1, 0LL)]);
  }
  cout << res << "\n";
  return 0;
}
