#include <bits/stdc++.h>
const int INF = 1e9;
const long long lINF = 1e18;
const double EPS = 1e-12;
using namespace std;
const int N = 1e5 + 100;
int n, m, k, a[N], rev[N];
int main() {
  scanf("%d%d%d", &n, &m, &k);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
    rev[a[i]] = i;
  }
  long long ans = m;
  for (int i = 0; i < m; i++) {
    int b;
    scanf("%d", &b);
    int pos = rev[b];
    if (pos != 1) {
      ans += (pos - 1) / k;
      swap(a[pos], a[pos - 1]);
      rev[a[pos]] = pos;
      rev[a[pos - 1]] = pos - 1;
    }
  }
  cout << ans << endl;
  return 0;
}
