#include <bits/stdc++.h>
using namespace std;
int a[100009], b[100009], x, y, k, n, m, c[100009];
long long ans;
int main() {
  cin >> n >> m >> k;
  for (int i = 0; i < n; i++) {
    cin >> x;
    a[x] = i + 1;
    if (i != 0)
      b[x] = y;
    else
      b[x] = 0;
    if (i != 0) c[y] = x;
    y = x;
  }
  for (int i = 0; i < m; i++) {
    cin >> x;
    y = a[x] / k;
    if (a[x] % k != 0) y++;
    ans = (long long)ans + y;
    if (b[x] != 0) {
      swap(a[x], a[b[x]]);
      b[c[x]] = b[x];
      c[b[b[x]]] = x;
      c[b[x]] = c[x];
      c[x] = b[x];
      y = b[b[x]];
      b[b[x]] = x;
      b[x] = y;
    }
  }
  cout << ans;
}
