You are given an array of positive integers a1, a2, ..., an × T of length n × T. We know that for any i > n it is true that ai = ai - n. Find the length of the longest non-decreasing sequence of the given array.

Input

The first line contains two space-separated integers: n, T (1 ≤ n ≤ 100, 1 ≤ T ≤ 107). The second line contains n space-separated integers a1, a2, ..., an (1 ≤ ai ≤ 300).

Output

Print a single number — the length of a sought sequence.

Examples

Input

4 3
3 1 4 2


Output

5

Note

The array given in the sample looks like that: 3, 1, 4, 2, 3, 1, 4, 2, 3, 1, 4, 2. The elements in bold form the largest non-decreasing subsequence. 
import java.io.*;
import java.util.*;
import java.math.*;

import javax.swing.plaf.BorderUIResource;

public class B implements Runnable {
    private static BufferedReader in;
    private static PrintWriter out;
    private static StringTokenizer st;
    private static Random rnd;

    private void solve() throws IOException {
        int numbersCount = nextInt(), repeatsCount = nextInt();
        int[] numbers = new int[numbersCount];
        for (int i = 0; i < numbersCount; i++)
            numbers[i] = nextInt();
        out.println(solveSmart(numbersCount, repeatsCount, numbers));

//      while (true) {
//          int n = 1 + rnd.nextInt(10);
//          int m = 1 + rnd.nextInt(10000);
//          int[] v = new int[n];
//          for (int i = 0; i < n; i++)
//              v[i] = 1 + rnd.nextInt(300);
//          if (solveDumb(n, m, v) != solveSmart(n, m, v)) {
//              out.println(solveDumb(n, m, v));
//              out.println(solveSmart(n, m, v));
//              out.println(n + " " + m + " " + Arrays.toString(v));
//              break;
//          }
//          out.println("OK");
//          out.flush();
//      }

    }

    private int solveDumb(int numbersCount, int repeatsCount, int[] numbers) {
        int BUBEN = repeatsCount * numbersCount;
        int maxValue = 0;
        for (int i = 0; i < numbersCount; i++) {
            maxValue = Math.max(maxValue, numbers[i]);
        }
        int[] results = new int[maxValue + 1];
        int finalResult = 0;
        for (int i = 0; i < BUBEN; i++) {
            int value = numbers[i % numbersCount];
            int maxOnPrefix = 0;
            for (int j = 0; j <= value; j++)
                maxOnPrefix = Math.max(maxOnPrefix, results[j]);
            results[value] = Math.max(results[value], maxOnPrefix + 1);
            int currentFinalResult = maxOnPrefix + 1;
            finalResult = Math.max(finalResult, currentFinalResult);
        }
        return finalResult;
    }

    private int solveSmart(int numbersCount, int repeatsCount, int[] numbers) {
        if (repeatsCount > 2 * numbersCount) {
            int[] prefixValues = getPrefixValues(numbersCount, numbersCount,
                    numbers);
            int[] suffixValues = getSuffixValues(numbersCount, numbersCount,
                    numbers);
            int remainRepeats = repeatsCount - 2 * numbersCount;
            if (prefixValues.length != suffixValues.length)
                throw new AssertionError();
            int maxValue = suffixValues.length - 1;
            int[] count = new int[maxValue + 1];
            for (int v : numbers)
                ++count[v];
            int result = 0;
            for (int i = 0; i <= maxValue; i++) {
                for (int j = i; j <= maxValue; j++) {
                    for (int k = i; k <= j; k++) {
                        int currentResult = prefixValues[i] + suffixValues[j]
                                + count[k] * remainRepeats;
                        result = Math.max(result, currentResult);
                    }
                }
            }
            return result;
        } else {
            return solveDumb(numbersCount, repeatsCount, numbers);
        }
    }

    private int[] getPrefixValues(int numbersCount, int repeatsCount,
            int[] numbers) {
        int BUBEN = numbersCount * repeatsCount;
        int maxValue = 0;
        for (int i = 0; i < numbersCount; i++) {
            maxValue = Math.max(maxValue, numbers[i]);
        }
        int[] results = new int[maxValue + 1];
        for (int i = 0; i < BUBEN; i++) {
            int value = numbers[i % numbersCount];
            int maxOnPrefix = 0;
            for (int j = 0; j <= value; j++)
                maxOnPrefix = Math.max(maxOnPrefix, results[j]);
            results[value] = Math.max(results[value], maxOnPrefix + 1);
        }
        return results;
    }

    private int[] getSuffixValues(int numbersCount, int repeatsCount,
            int[] numbers) {
        int BUBEN = numbersCount * repeatsCount;
        int maxValue = 0;
        for (int i = 0; i < numbersCount; i++) {
            maxValue = Math.max(maxValue, numbers[i]);
        }
        int[] results = new int[maxValue + 1];
        for (int i = BUBEN - 1; i >= 0; i--) {
            int value = numbers[i % numbersCount];
            int maxOnSuffix = 0;
            for (int j = value; j <= maxValue; j++)
                maxOnSuffix = Math.max(maxOnSuffix, results[j]);
            results[value] = Math.max(results[value], maxOnSuffix + 1);
        }
        return results;
    }

    public static void main(String[] args) {
        new B().run();
    }

    public void run() {
        final String className = this.getClass().getName().toLowerCase();

        try {
            try {
                in = new BufferedReader(new FileReader(className + ".in"));
                out = new PrintWriter(new FileWriter(className + ".out"));
            } catch (FileNotFoundException e) {
                in = new BufferedReader(new InputStreamReader(System.in));
                out = new PrintWriter(System.out);
            }

            rnd = new Random();

            solve();

            out.close();
        } catch (IOException e) {
            e.printStackTrace();
            System.exit(1);
        }
    }

    private String nextToken() throws IOException {
        while (st == null || !st.hasMoreTokens()) {
            String line = in.readLine();

            if (line == null)
                return null;

            st = new StringTokenizer(line);
        }

        return st.nextToken();
    }

    private int nextInt() throws IOException {
        return Integer.parseInt(nextToken());
    }

    private long nextLong() throws IOException {
        return Long.parseLong(nextToken());
    }

    private double nextDouble() throws IOException {
        return Double.parseDouble(nextToken());
    }
}