#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:36777216")
using namespace std;
const int N = 2e5 + 7;
const int MOD = 1e9 + 7;
const int INF = 1e9 + 7;
const double EPS = 1e-8;
int t, n, m, K, a[N], pos[N];
long long tot;
int main() {
  cin >> n >> m >> K;
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
    pos[a[i]] = i;
  }
  while (m--) {
    scanf("%d", &t);
    tot += (((long long)pos[t] - 1) / K + 1);
    if (pos[t] != 1) {
      int preNum = a[pos[t] - 1];
      swap(a[pos[t]], a[pos[t] - 1]);
      pos[preNum]++;
      pos[t]--;
    }
  }
  cout << tot << endl;
}
