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.*;


public class Solution {
    private BufferedReader in;
    private StringTokenizer line;
    private PrintWriter out;

    public void solve() throws IOException {
        final int INF = 1000000000;
        int n = nextInt();
        int t = nextInt();
        int[] a = nextIntArray(n);
        if (t == 1) {
            int[] d = new int[n];
            int res = 0;
            for (int i = 0; i < n; i++) {
                d[i] = 1;
                for (int j = 0; j < i; j++) {
                    if (a[j] <= a[i] && d[j] + 1 > d[i]) {
                        d[i] = d[j] + 1;
                    }
                }
                res = Math.max(res, d[i]);
            }
            out.println(res);
        } else {
            int[] cnt = new int[313];
            for (int i = 0; i < n; i++) {
                cnt[a[i]]++;
            }
            int[] tmp = new int[n * n + 2];
            int tmplen = tmp.length;
            int[][] d0 = new int[313][];
            for (int i = 0; i < n; i++) {
                if (d0[a[i]] == null) {
                    int mx = a[i];
                    int[] b = new int[n];

                    tmp[0] = -INF;
                    for (int j = 1; j < tmp.length; j++) {
                        tmp[j] = INF;
                    }

                    int mxidx = -1;
                    for (int tt = 0; tt < n; tt++) {
                        for (int j = 0; j < n; j++) {
                            int num = a[j];
                            if (num <= mx) {
                                int k = Arrays.binarySearch(tmp, num);
                                if (k >= 0) {
                                    for (int st = 1 << 13; st > 0; st >>= 1) {
                                        if (k + st < tmplen && tmp[k] == tmp[k + st]) {
                                            k += st;
                                        }
                                    }
                                    k++;
                                } else {
                                    k = -k - 1;
                                }
                                if (tmp[k - 1] <= num && num <= tmp[k]) {
                                    tmp[k] = num;
                                    mxidx = Math.max(mxidx, k);
                                }
                            }
                        }
                        b[tt] = mxidx;
                    }
                    d0[a[i]] = b;
                }
            }
            int[][] d1 = new int[313][];
            for (int i = 0; i < n; i++) {
                if (d1[a[i]] == null) {
                    int mn = a[i];
                    int[] b = new int[n];

                    tmp[0] = -INF;
                    for (int j = 1; j < tmp.length; j++) {
                        tmp[j] = INF;
                    }

                    int mxidx = -1;
                    for (int tt = 0; tt < n; tt++) {
                        for (int j = n - 1; j >= 0; j--) {
                            int num = -a[j];
                            if (mn <= -num) {
                                int k = Arrays.binarySearch(tmp, num);
                                if (k >= 0) {
                                    for (int st = 1 << 13; st > 0; st >>= 1) {
                                        if (k + st < tmplen && tmp[k] == tmp[k + st]) {
                                            k += st;
                                        }
                                    }
                                    k++;
                                } else {
                                    k = -k - 1;
                                }
                                if (tmp[k - 1] <= num && num <= tmp[k]) {
                                    tmp[k] = num;
                                    mxidx = Math.max(mxidx, k);
                                }
                            }
                        }
                        b[tt] = mxidx;
                    }
                    d1[a[i]] = b;
                }
            }
            int res = 0;

//            int[] nxt = new int[313];
//            int lst = 313;
//            for (int i = 312; i >= 0; i--) {
//                nxt[i] = lst;
//                if (cnt[i] > 0) lst = i;
//            }

            for (int i = 0; i < 313; i++) {
                if (cnt[i] > 0) {
//                    int nx = nxt[i];
//                    if (nx < 313) {
                    for (int x = 0; x < n; x++) {
                        for (int y = 0; y < n; y++) {
                            if (x + y + 2 <= t) {
                                res = Math.max(res, (t - x - y - 2) * cnt[i] + d0[i][x] + d1[i][y]);
                            }
                        }
                    }
//                    }
                }
            }
            for (int i = 0; i < 313; i++) {
                if (cnt[i] > 0) {
                    for (int x = 0; x < n; x++) {
                        if (x + 1 <= t) {
                            res = Math.max(res, (t - x - 1) * cnt[i] + d0[i][x]);
                            res = Math.max(res, (t - x - 1) * cnt[i] + d1[i][x]);
                        }
                    }
                }
            }

            out.println(res);
        }
    }

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

    public void run(String[] args) throws IOException {
        if (args.length > 0 && "DEBUG_MODE".equals(args[0])) {
            in = new BufferedReader(new InputStreamReader(new FileInputStream("input.txt")));
        } else {
            in = new BufferedReader(new InputStreamReader(System.in));
        }
        out = new PrintWriter(System.out);

//        int t = nextInt();
        int t = 1;
        for (int i = 0; i < t; i++) {
            solve();
        }

        in.close();
        out.flush();
        out.close();
    }

    private int[] nextIntArray(int n) throws IOException {
        int[] res = new int[n];
        for (int i = 0; i < n; i++) {
            res[i] = nextInt();
        }
        return res;
    }

    private long[] nextLongArray(int n) throws IOException {
        long[] res = new long[n];
        for (int i = 0; i < n; i++) {
            res[i] = nextInt();
        }
        return res;
    }

    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());
    }

    private String nextToken() throws IOException {
        while (line == null || !line.hasMoreTokens()) {
            line = new StringTokenizer(in.readLine());
        }
        return line.nextToken();
    }

    private static class Pii {
        private int key;
        private int value;

        public Pii(int key, int value) {
            this.key = key;
            this.value = value;
        }

        @Override
        public boolean equals(Object o) {
            if (this == o) return true;
            if (o == null || getClass() != o.getClass()) return false;

            Pii pii = (Pii) o;

            if (key != pii.key) return false;
            return value == pii.value;

        }

        @Override
        public int hashCode() {
            int result = key;
            result = 31 * result + value;
            return result;
        }
    }

    private static class Pair<K, V> {
        private K key;
        private V value;

        public Pair(K key, V value) {
            this.key = key;
            this.value = value;
        }

        public K getKey() {
            return key;
        }

        public V getValue() {
            return value;
        }

        @Override
        public boolean equals(Object o) {
            if (this == o) return true;
            if (o == null || getClass() != o.getClass()) return false;

            Pair<?, ?> pair = (Pair<?, ?>) o;

            if (key != null ? !key.equals(pair.key) : pair.key != null) return false;
            return !(value != null ? !value.equals(pair.value) : pair.value != null);

        }

        @Override
        public int hashCode() {
            int result = key != null ? key.hashCode() : 0;
            result = 31 * result + (value != null ? value.hashCode() : 0);
            return result;
        }
    }
}
