#include <bits/stdc++.h>
using namespace std;
const int M = 1e5 + 10, inf = 0x3f3f3f3f;
int id[M];
int orm[M];
int n, m, k;
int main() {
  ios::sync_with_stdio(false);
  cin >> n >> m >> k;
  for (int i = 0; i < n; i++) {
    cin >> id[i];
    orm[id[i]] = i;
  }
  long long tot = 0;
  while (m--) {
    int x;
    cin >> x;
    int tmp = orm[x];
    int ye = tmp / k;
    tot += 1ll * ye + 1ll;
    if (tmp == 0) continue;
    swap(orm[id[tmp]], orm[id[tmp - 1]]);
    swap(id[tmp], id[tmp - 1]);
  }
  cout << tot << endl;
}
