#include <bits/stdc++.h>
using namespace std;
int a[100005], pos[100005];
int main() {
  int n, m, k;
  cin >> n >> m >> k;
  for (int i = 1; i <= n; i++) cin >> a[i], pos[a[i]] = i;
  long long ans = 0;
  for (int i = 1; i <= m; i++) {
    int x;
    cin >> x;
    int f = pos[x];
    ans += ((long long)(f - 1) / k) + 1;
    if (pos[x] != 1) {
      int temp = pos[x];
      int l = a[pos[x] - 1];
      pos[x] = temp - 1;
      pos[l] = temp;
      a[temp - 1] = x;
      a[temp] = l;
    }
  }
  cout << ans << endl;
}
