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.InputStreamReader;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.util.Arrays;
import java.io.BufferedWriter;
import java.io.BufferedReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.Writer;
import java.util.StringTokenizer;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        OutputWriter out = new OutputWriter(outputStream);
        TaskD solver = new TaskD();
        solver.solve(1, in, out);
        out.close();
    }
}

class TaskD {
    public void solve(int testNumber, InputReader in, OutputWriter out) {
        int n = in.nextInt(), t = (int) in.nextLong();
        int ar[] = new int[n];
        int hash[] = new int[301];
        for (int i = 0; i < n; i++) {
            ar[i] = in.nextInt();
            hash[ar[i]]++;
        }
        if (n * t <= 5000) {
            int temp[] = new int[n * t];
            for (int i = 0; i < n * t; i++) {
                temp[i] = ar[i % n];
            }
            out.printLine(calc(temp));
        } else {
            int max = 0, maxfq = 0;
            for (int i = 1; i <= 300; i++) {
                if (hash[i] > maxfq) {
                    maxfq = hash[i];
                    max = i;
                }
            }
            int finalans = 0;
            int ar1[] = new int[n * n];
            for (int i = 0; i < n * n; i++) {
                ar1[i] = ar[i % n];
            }
            int ans = maxfq * (t - 2 * n);
            int L[] = calc1(ar1);
            int temp = 0;
            for (int i = n * n - 1; i >= 0; i--) {
                if (ar1[i] <= max) {
                    if (L[i] > temp)
                        temp = L[i];
                }
            }
            ans += temp;
            temp = 0;
            L = calc2(ar1);

            for (int i = 0; i < n * n; i++) {
                if (ar1[i] >= max) {
                    if (temp < L[i]) {
                        temp = L[i];

                    }
                }
            }
            ans += temp;
            if (ans > finalans)
                finalans = ans;
            out.printLine(finalans);
        }
    }

    public int[] calc1(int ar[]) {
        int n = ar.length;
        int L[] = new int[n];
        Arrays.fill(L, 1);
        for (int i = 1; i < n; i++) {
            for (int j = 0; j < i; j++) {
                if (ar[j] <= ar[i] && L[i] < (L[j] + 1)) {
                    L[i] = L[j] + 1;
                }
            }
        }
        return L;
    }

    public int[] calc2(int ar[]) {
        int n = ar.length;
        int L[] = new int[n];
        Arrays.fill(L, 1);
        for (int i = n - 2; i >= 0; i--) {
            for (int j = i + 1; j < n; j++) {
                if (ar[j] >= ar[i] && L[i] < (L[j] + 1)) {
                    L[i] = L[j] + 1;
                }
            }
        }
        return L;
    }

    public int calc(int ar[]) {
        int n = ar.length;
        int L[] = new int[n];
        Arrays.fill(L, 1);
        for (int i = 1; i < n; i++) {
            for (int j = 0; j < i; j++) {
                if (ar[j] <= ar[i] && L[i] < (L[j] + 1)) {
                    L[i] = L[j] + 1;
                }
            }
        }
        int max = 1;
        for (int i = 0; i < n; i++) {
            max = Math.max(L[i], max);
        }
        return max;
    }
}

class InputReader {
    BufferedReader in;
    StringTokenizer tokenizer=null;

    public InputReader(InputStream inputStream)
    {
        in=new BufferedReader(new InputStreamReader(inputStream));
    }
    public String next()
    {
        try{
            while (tokenizer==null||!tokenizer.hasMoreTokens())
            {
                tokenizer=new StringTokenizer(in.readLine());
            }
            return tokenizer.nextToken();
        }
        catch (IOException e)
        {
            return null;
        }
    }
    public int nextInt()
    {
        return Integer.parseInt(next());
    }
    public long nextLong()
    {
        return Long.parseLong(next());
    }
}

class OutputWriter {
        private final PrintWriter writer;

        public OutputWriter(OutputStream outputStream) {
            writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
        }

    public void print(Object...objects) {
            for (int i = 0; i < objects.length; i++) {
                if (i != 0)
                    writer.print(' ');
                writer.print(objects[i]);
            }
        }

        public void printLine(Object...objects) {
            print(objects);
            writer.println();
        }

        public void close() {
            writer.close();
        }
}
