import std.algorithm;
import std.array;
import std.container;
import std.conv;
import std.math;
import std.numeric;
import std.stdio;
import std.string;
import std.typecons;

void log(A...)(A arg) {
    stderr.writeln(arg);
}

void main() {
    int N, M, K;
    scanf("%d %d %d\n", &N, &M, &K);
    auto D = readln.chomp.split(" ").map!((x) => x.to!int - 1).array;
    auto V = new int[][N];
    foreach (i; 0 .. N) {
        V[i] = readln.chomp.split(" ").map!((x) => x.to!int - 1).array;
    }

    auto darkRoomIndex = new int[N];
    darkRoomIndex[] = -1;
    foreach (int i, d; D) {
        darkRoomIndex[d] = i;
    }

    immutable int INF = 1<<28;
    auto dist = new int[1<<M]; dist[] = INF;
    DList!int Q; Q.insert( (1<<M) - 1 );
    dist[ (1<<M) - 1 ] = 0;
    while (!Q.empty) {
        int c = Q.front; Q.removeFront;
        foreach (k; 0 .. K) {
            int nextRooms = 0;
            foreach (i; 0 .. M) {
                if (! (c & (1 << i))) continue;
                int n = darkRoomIndex[ V[ D[i] ][k] ];
                if (n < 0) continue;
                nextRooms |= 1 << n;
            }
            if (dist[nextRooms] > dist[c] + 1) {
                dist[nextRooms] = dist[c] + 1;
                Q.insert(nextRooms);
            }
        }
    }
    writeln(dist[0]);


}