#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int n, m, k;
  cin >> n >> m >> k;
  vector<int> apps(n);
  vector<int> pos(n);
  for (int i = 0; i < n; i++) {
    cin >> apps[i];
    apps[i]--;
    pos[apps[i]] = i;
  }
  int a;
  long long res = 0;
  for (int i = 0; i < m; i++) {
    cin >> a;
    a--;
    int p = pos[a];
    res += (p / k + 1);
    if (p > 0) {
      swap(apps[p], apps[p - 1]);
      swap(pos[apps[p]], pos[apps[p - 1]]);
    }
  }
  cout << res << endl;
  return 0;
}
