#include <bits/stdc++.h>
using namespace std;
long long int logy(long long int x, long long int y) {
  return ceil((long double)(log(x) / log(y)));
}
long long int powe(long long int a, long long int b) {
  long long int re = 1;
  while (b) {
    if (b & 1) re = (re * a);
    a = (a * a);
    b = b >> 1;
  }
  return re;
}
bool flag = 0, flag1 = 0, flag2 = 0;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long int tt = 1;
  while (tt--) {
    long long int n, m, k;
    cin >> n >> m >> k;
    long long int now[n], ans = 0;
    for (int i = 0; i < n; i++) cin >> now[i];
    ;
    long long int order[100005] = {0};
    for (long long int i = 0; i < n; i++) order[now[i]] = i;
    for (long long int i = 0; i < m; i++) {
      ans++;
      long long int x;
      cin >> x;
      long long int ind = order[x];
      if (ind == 0) continue;
      order[now[ind]]--;
      order[now[ind - 1]]++;
      swap(now[ind], now[ind - 1]);
      ans += (ind / k);
    }
    cout << ans;
  }
  return 0;
}
