#include <bits/stdc++.h>
using namespace std;
int a[100005];
int b[100005];
vector<int> c[100005];
int main() {
  ios_base::sync_with_stdio(0);
  int n, m, k;
  cin >> n >> m >> k;
  for (int i = 0; i < n; i++) {
    int x;
    cin >> x;
    a[x] = i / k;
    b[x] = i % k;
    c[i / k].push_back(x);
  }
  long long res = 0;
  while (m-- > 0) {
    int x;
    cin >> x;
    res += a[x] + 1;
    if (b[x] != 0) {
      int z = c[a[x]][b[x] - 1];
      swap(c[a[x]][b[x] - 1], c[a[x]][b[x]]);
      b[x]--;
      b[z]++;
    } else if (a[x] != 0) {
      int z = c[a[x] - 1][k - 1];
      swap(c[a[x]][b[x]], c[a[x] - 1][k - 1]);
      b[x] = k - 1;
      b[z] = 0;
      a[x]--;
      a[z]++;
    }
  }
  cout << res << endl;
  return 0;
}
