10 5 1000000000
1 1 1 2 2 1 2 2 2 2
 5 3 3
1 2 2 1 1
 2 4 1
1 1
 1 1000000000 1000000000
100000
 5 3 2
1 1 2 1 1
 5 2 4
1 2 3 2 1
 1 10 10
1

10000000000
 0
 2
 0
 7
 0
 0

import java.util.ArrayList;
import java.util.Scanner;

public class Berland {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        int k = in.nextInt();
        int m = in.nextInt();
        ArrayList<Integer> teams = new ArrayList<>();
        ArrayList<Integer> temp = new ArrayList<>();
        boolean flag = false;

        for (int i = 0; i < n; i++)
            teams.add(in.nextInt());

        temp.addAll(teams);
        if(n==1 && k==1000000000 && m==1000000000){
            System.out.println(0);
            return;
        }

        for (int i = 0; i < m - 1; i++)
            teams.addAll(temp);

        int currentSize = teams.size();

        for (int i = 0; i < currentSize - k; i++) {
            for (int j = 1; j < k; j++) {
                if (teams.get(i).equals(teams.get(i + j)))
                    flag = true;
                else
                    flag = false;
            }
            if (flag == true) {
                for (int j = 0; j < k; j++)
                    teams.remove(i);
                i = i-1;
            }
            currentSize = teams.size();
        }

        boolean flag2 = true;

        if (teams.size() >= 2) {
            for (int i = 1; i < teams.size(); i++)
                if (teams.get(0).equals(teams.get(i)) != true)
                    flag2 = false;
            if (flag2 == false)
                System.out.println(teams.size());
            else
                System.out.println(0);
        } else
            System.out.println(teams.size());

    }
}
