#include <bits/stdc++.h>
using namespace std;
const int MAXN = 100005;
int N, M, K, X, pos[MAXN], inv[MAXN];
long long res;
int main() {
  cin >> N >> M >> K;
  for (int i = 0; i < N; i++) {
    cin >> inv[i];
    inv[i] -= 1;
    pos[inv[i]] = i;
  }
  for (int i = 0; i < M; i++) {
    cin >> X;
    X -= 1;
    res += pos[X] / K;
    if (pos[X] > 0) {
      int pre = inv[pos[X] - 1];
      pos[pre] += 1;
      inv[pos[X]] = pre;
      inv[pos[X] - 1] = X;
      pos[X] -= 1;
    }
  }
  cout << res + M << '\n';
}
