#include <bits/stdc++.h>
using namespace std;
struct tint {
  int l, i, r;
} a[101010];
int i, j, n, m, tmp[101010], k, ch1, ch2, q, ch3;
long long ans;
void swapp(int i, int j) {
  int a1, a2, a3, b1, b2, b3;
  a1 = a[i].l;
  a2 = a[i].i;
  a3 = a[i].r;
  b1 = a[j].l;
  b2 = a[j].i;
  b3 = a[j].r;
  a[j].l = a1;
  a[j].i = a2;
  a[j].r = i;
  a[i].l = j;
  a[i].i = b2;
  a[i].r = b3;
}
int main() {
  cin >> n >> m >> k;
  for (i = 1; i <= n; i++) {
    cin >> tmp[i];
    a[tmp[i - 1]].r = tmp[i];
    a[tmp[i]].i = i;
    a[tmp[i]].l = tmp[i - 1];
  }
  for (i = 1; i <= m; i++) {
    cin >> q;
    int add;
    if (a[q].i % k == 0)
      add = a[q].i / k;
    else
      add = a[q].i / k + 1;
    ans += add;
    if (a[q].i == 1) continue;
    ch1 = a[q].l;
    ch2 = a[q].r;
    ch3 = a[ch1].l;
    swapp(a[q].l, q);
    if (ch2) a[ch2].l = ch1;
    if (ch3) a[ch3].r = q;
  }
  cout << ans;
  return 0;
}
