#include <bits/stdc++.h>
using namespace std;
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
int main() {
  int n, m, k;
  cin >> n >> m >> k;
  int a[n];
  long long x, s = m, p;
  map<int, int> ma;
  for (int i = 0; i < n; i++) {
    scanf("%d", &a[i]);
    ma[a[i]] = i;
  }
  for (int i = 0; i < m; i++) {
    scanf("%d", &x);
    p = ma[x];
    s += p / k;
    if (p > 0) {
      a[p] = a[p - 1];
      a[p - 1] = x;
      ma[x]--;
      ma[a[p]]++;
    }
  }
  cout << s;
  return 0;
}
