#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast")
void disp(int x[], int n) {
  for (int i = 0; i < n; ++i) {
    cout << x[i] << ' ';
  }
  cout << endl;
}
void solve() {
  int n, m, k;
  cin >> n >> m >> k;
  int a[n], b[m];
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
  }
  for (int i = 0; i < m; ++i) {
    cin >> b[i];
  }
  int gestures = 0;
  for (int i = 0; i < m; ++i) {
    int toFind = b[i];
    int idx = -1;
    for (int j = 0; j < n; ++j) {
      if (a[j] == toFind) {
        idx = j;
        break;
      }
    }
    cout << "Index of " << toFind << " is = " << idx << endl;
    gestures += ceil((double(idx) + 1) / k);
    if (idx != 0) {
      swap(a[idx], a[idx - 1]);
    }
    disp(a, n);
  }
  cout << gestures << endl;
}
void dispMap(map<int, int> mp) {
  for (auto x : mp) {
    cout << x.first << " -> " << x.second << endl;
  }
  cout << "-------------------------" << endl;
}
void solve_2() {
  long long n, m, k;
  cin >> n >> m >> k;
  long long b[m], a[n];
  map<long long, long long> appIndex;
  for (long long i = 0; i < n; ++i) {
    cin >> a[i];
    appIndex[a[i]] = i;
  }
  for (long long i = 0; i < m; ++i) {
    cin >> b[i];
  }
  long long gestures = 0;
  for (long long i = 0; i < m; ++i) {
    long long toFind = b[i];
    long long idx = appIndex[toFind];
    gestures += ceil((double(idx) + 1) / k);
    if (idx != 0) {
      swap(appIndex[a[idx]], appIndex[a[idx - 1]]);
      swap(a[idx], a[idx - 1]);
    }
  }
  cout << gestures << endl;
}
int main() {
  int tt = 1;
  while (tt--) {
    solve_2();
  }
}
