#include <bits/stdc++.h>
using namespace std;
const int N = 1e5;
int pos[N + 100], arr[N + 100];
int main() {
  int n, m, k;
  cin >> n >> m >> k;
  for (int i = 1; i <= n; i++) {
    cin >> arr[i];
    pos[arr[i]] = i;
  }
  long long ans = 0;
  for (int i = 1; i <= m; i++) {
    int b;
    cin >> b;
    ans += (pos[b] + k - 1) / k;
    if (pos[b] != 1) {
      int t1 = pos[b] - 1;
      swap(arr[t1], arr[pos[b]]);
      pos[arr[t1]] = t1;
      pos[arr[t1 + 1]] = t1 + 1;
    }
  }
  cout << ans << "\n";
}
