#include <bits/stdc++.h>
int Set(int N, int pos) { return N = N | (1 << pos); }
int reSet(int N, int pos) { return N = N & ~(1 << pos); }
bool check(int N, int pos) { return (bool)(N & (1 << pos)); }
using namespace std;
map<int, int> pos, serial;
int main() {
  int n, m, k, t, cur;
  cin >> n >> m >> k;
  for (int i = 0; i < n; i++) {
    scanf("%d", &t);
    pos[t] = i;
    serial[i] = t;
  }
  long long ans = 0;
  for (int i = 0; i < m; i++) {
    scanf("%d", &t);
    cur = pos[t];
    ans += (cur * 1LL) / k + 1;
    if (cur > 0) {
      cur--;
      int tmp = serial[cur];
      serial[cur] = t;
      serial[cur + 1] = tmp;
      pos[t] = cur;
      pos[tmp] = cur + 1;
    }
  }
  cout << ans << "\n";
  return 0;
}
