#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, m, k, l, a, b, c, d, i, j, tmp;
  cin >> n >> m >> k;
  long long pos[n + 10], ara[n + 10];
  for (i = 1; i <= n; i++) {
    cin >> tmp;
    ara[i] = tmp;
    pos[tmp] = i;
  }
  long long sum = 0;
  for (i = 1; i <= m; i++) {
    cin >> tmp;
    a = pos[tmp];
    if (a % k == 0)
      c = floor(a / k);
    else
      c = floor(a / k) + 1;
    sum += c;
    if (pos[tmp] != 1) {
      a = pos[tmp] - 1;
      b = ara[a];
      pos[b]++;
      pos[tmp]--;
      swap(ara[a], ara[a + 1]);
    }
  }
  cout << sum << endl;
  return 0;
}
