#include <bits/stdc++.h>
using namespace std;
int n, m, k;
const int mn = 1e5 + 10;
int pos[mn];
int en_pos[mn];
int main() {
  cin >> n >> m >> k;
  for (int i = 0; i < n; i++) {
    int t;
    cin >> t;
    t--;
    pos[t] = i;
    en_pos[i] = t;
  }
  long long tot = 0LL;
  for (int i = 0; i < m; i++) {
    int t;
    cin >> t;
    t--;
    int pp = pos[t];
    tot += (pp / k) + 1LL;
    if (pp) {
      int quien = en_pos[pp - 1];
      pos[quien] = pp;
      pos[t] = pp - 1;
      en_pos[pp - 1] = t;
      en_pos[pp] = quien;
    }
  }
  cout << tot << endl;
  return 0;
}
