#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 5;
int n, m, k;
int pos[maxn];
int ar[maxn];
int main() {
  cin >> n >> m >> k;
  for (int i = 1; i <= n; i++) {
    cin >> ar[i];
    pos[ar[i]] = i;
  }
  long long ans = 0;
  for (int i = 1; i <= m; i++) {
    int b;
    cin >> b;
    ans += (long long)((pos[b] - 1) / k + 1);
    if (pos[b] == 1) continue;
    swap(ar[pos[b]], ar[pos[b] - 1]);
    swap(pos[b], pos[ar[pos[b]]]);
  }
  cout << ans << endl;
}
