#include <bits/stdc++.h>
using namespace std;
long long n, m, k;
map<long long, long long> pos, icon;
void read() {
  cin >> n >> m >> k;
  for (long long i = 1; i <= n; i++) {
    long long temp;
    cin >> temp;
    pos[temp] = i;
    icon[i] = temp;
  }
}
void solve() {
  long long ans = 0;
  for (long long i = 1; i <= m; i++) {
    long long queri;
    cin >> queri;
    ans += -(pos[queri] % k == 0) + pos[queri] / k;
    long long temp = icon[pos[queri]];
    if (pos[queri] != 1)
      icon[pos[queri]] = icon[pos[queri] - 1], icon[pos[queri] - 1] = temp,
      pos[icon[pos[queri]]] = pos[queri],
      pos[icon[pos[queri] - 1]] = pos[queri] - 1;
  }
  cout << ans + m;
}
signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  read(), solve();
}
