#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, m, k;
  cin >> n >> m >> k;
  vector<int> v;
  int num;
  map<int, int> position;
  vector<int> test;
  v.push_back(-1);
  for (int i = 1; i <= n; ++i) {
    cin >> num;
    v.push_back(num);
    position[num] = i;
  }
  for (int i = 0; i < m; ++i) {
    cin >> num;
    test.push_back(num);
  }
  long long count = 0, temp, temp_map;
  for (int i = 0; i < m; ++i) {
    temp_map = position[test[i]];
    temp = ceil(static_cast<double>(temp_map) / k);
    count += temp;
    if (temp_map > 1) {
      swap(v[temp_map], v[temp_map - 1]);
      position[v[temp_map - 1]] = temp_map - 1;
      position[v[temp_map]] = temp_map;
    }
  }
  cout << count << endl;
  return 0;
}
