#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 5, M = 1e9 + 7;
const double pi = acos(-1.0), eps = 1e-9;
int dx4[] = {-1, 0, 1, 0};
int dy4[] = {0, 1, 0, -1};
int n, m, k;
int a[N], pos[N];
int main() {
  cin >> n >> m >> k;
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
    pos[a[i]] = i;
  }
  long long ans = 0;
  for (int i = 1; i <= m; i++) {
    int x;
    scanf("%d", &x);
    int p = pos[x];
    int w = p / k;
    if (p % k != 0) w++;
    ans += w;
    if (p == 1)
      continue;
    else {
      int y = a[p - 1];
      pos[x] = p - 1;
      pos[y] = p;
      swap(a[p], a[p - 1]);
    }
  }
  cout << ans << endl;
  return 0;
}
