#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  long long n, m, k;
  cin >> n >> m >> k;
  long long ar1[n + 2], pos[n + 2], ar2[m + 2];
  memset(ar1, 0, sizeof(ar1));
  memset(pos, 0, sizeof(pos));
  memset(ar2, 0, sizeof(ar2));
  for (long long i = 1; i <= n; i++) {
    cin >> ar1[i];
    pos[ar1[i]] = i;
  }
  long long sum = 0;
  for (long long i = 1; i <= m; i++) {
    long long val;
    cin >> val;
    sum += (pos[val] / k);
    if (pos[val] % k) sum++;
    if (pos[val] != 1) {
      long long k = ar1[pos[val] - 1];
      swap(ar1[pos[val] - 1], ar1[pos[val]]);
      pos[k] = pos[val];
      pos[val] = pos[val] - 1;
    }
  }
  cout << sum;
  return 0;
}
